cf/mirror

Choosing Two Paths

CF
1073F2500· grandmaster2s256 MB⌨ stdin/stdout

Examples

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