#0000C6

mit-stacks

You are given three stacks of coins, labeled {1, 2, 3}. The only operation allowed is choosing two stacks that contain X and Y coins (we assume that X >= Y and moving Y coins from the bigger stack to the smaller. Effectively, after this operation, if the stacks started with X and Y coins, they will have X-Y and 2*Y coins.


Given the number of coins in the three stacks, you must perform operations such that in the end, one of the stacks is empty. Your solution does NOT have to use a minimum number of operations.


InputYou should read all data from standard input.
The input has 3 non-negative integers which represent the number of coins in the three stacks.

OutputYou should write all data to standard output.
Each line of the output data must contain a pair of numbers representing indices of stacks involved in operations. The first number in the pair must correspond to the smaller stack. End your output with the line "0 0" (no quotes).
If there is no solution, output a single line containing ``-1 -1''.

You can assume that each stack has at most 100,000,000 (100 million) coins.


Input:
5 3 7
Output:
2 3 // produces 5 6 4
3 1 // produces 1 6 8
2 3 // produces 1 12 2
1 2 // produces 2 11 2
1 3 // produces 4 11 0
0 0 // end of output

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.