I. Island Tour
time limit per test
7 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
6
1 1 1 1 1 1
2 1 3 2 3 1
8 7 4 9 7 2
7 6 2 9 2 1
Output
1 5 6
Input
4
1 1 1 1
1 1 1 1
10 3 2 1
4 2 5 1
Output
impossible