Sjkmost persuaded Justin to force his citizens to trip with zipline. However, the citizens are not strong enough and the citizens often fell from the zipline. Therefore, they decided to provide the citizens with some cable cars. Now Sjkmost is preparing the cable cars.
There are
Sjkmost can spend
Sjkmost has a budget of
lhyyy, who is not good at graph theory at all and got lost in Justin's city, luckily met Justin at last. Now he doesn't know how to leave the city. If he can help sort the cable cars for Sjkmost, Sjkmost will tell him how to leave. However, lhyyy is not good at sorting as well. Can you help him?
The first line contains an integer
The second line contains
Output the operations in order.
Each line contains two integers
Finally, output a line -1 -1
denoting the end of the output.
There must be an empty line at the end of the output!
If there are multiple solutions, you can print any of them.
4
1 3 2 4
2 3
-1 -1
4
4 3 2 1
1 3
1 4
2 4
-1 -1
10
11 4 5 1 4 1 91 9 8 10
1 2
2 3
3 5
7 9
5 7
2 3
5 6
3 5
1 4
7 8
9 10
8 9
-1 -1
For 10% testcases,
For 20% testcases,
For 30% testcases,
For 50% testcases,
For 70% testcases,
For 100% testcases,