atcoder#AGC061B. [AGC061B] Summation By Construction
[AGC061B] Summation By Construction
Score : points
Problem Statement
There is a graph with vertices on the left, and vertices on the right. Each vertex () is connected to each vertex (), that is, the graph contains edges.
We color every edge with one of the colors . A coloring is suitable if for each there are exactly edges of color , and those edges form a simple path.
Formally, for each there should exist a sequence of distinct vertices such that all of the following is true:
- For each , vertices and are connected with an edge of color ,
- No other edges of color exist.
Find any suitable coloring, or determine that it doesn't exist.
For each input file, solve test cases.
Constraints
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
For each test case, if a suitable coloring does not exist, print No
. Otherwise, print a suitable coloring description in the following format:
Yes
Here, is the color of the edge between and .
If there are many suitable colorings, print any of them.
2
1
2
Yes
1 1
No