F. Island Isolation
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
6
1 2
2 3
2 4
1 5
5 6
Output
2 3
2 4
1 2
5 1
5 6
1 5
2 1
3 2
4 2
6 5