cf/mirror

Build a Tree and That Is It

CF
1714F1900· candidate master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
9
5 1 2 1
5 2 2 2
5 2 2 3
5 2 2 4
5 3 2 3
4 2 1 1
4 3 1 1
4 1 2 3
7 1 4 1
Output
YES
1 2
4 1
3 1
2 5
YES
4 3
2 5
1 5
5 3
NO
YES
2 4
4 1
2 5
5 3
YES
5 4
4 1
2 5
3 5
YES
2 3
3 4
1 3
NO
YES
4 3
1 2
2 4
NO
1714F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…