atcoder#ABC291E. [ABC291E] Find Permutation
[ABC291E] Find Permutation
Score : points
Problem Statement
There is a length- sequence that is a permutation of .
While you do not know , you know that M(X_i,Y_i)$.
Can be uniquely determined? If it is possible, find .
Constraints
- All values in the input are integers.
- There is an consistent with the input.
Input
The input is given from Standard Input in the following format:
Output
If can be uniquely determined, print Yes
in the first line. Then, print in the second line, separated by spaces.
If cannot be uniquely determined, just print No
.
3 2
3 1
2 3
Yes
3 1 2
We can uniquely determine that .
3 2
3 1
3 2
No
Two sequences and can be .
4 6
1 2
1 2
2 3
2 3
3 4
3 4
Yes
1 2 3 4