Problem E
Erase One Account
You are given three bank accounts with initial balances $A$, $B$, and $C$ (non-negative integers).
You may perform the following operation any number of times:
-
Choose two distinct accounts $X$ and $Y$.
-
Transfer from account $X$ to account $Y$ an amount equal to the current balance of account $Y$.
-
Formally, the balances change as follows:
\[ X := X - Y, \qquad Y := 2Y. \] -
The operation is allowed only if the balance of account $X$ is at least the balance of account $Y$ before the transfer.
Your goal is to make at least one account have balance equal to $0$. In other words, after performing some sequence of operations, at least one of the three balances must become zero.
It can be proven that this is always possible.
Input
The first line contains an integer $t$ — the number of test cases ($t \le 10^3$).
Each of the next $t$ lines contains three integers $A$, $B$, and $C$.
\[ 0 \le A, B, C \le 10^{18} \]Output
For each test case, first print an integer $k$ — the number of operations.
Then print $k$ lines, each containing two integers $X$ and $Y$ ($1 \le X, Y \le 3$, $X \ne Y$), meaning you transfer money from account $X$ to account $Y$.
After performing all operations, at least one account must have balance equal to $0$.
If multiple solutions exist, output any of them.
The number of operations for each test case must not exceed $3000$.
Sample 1 Explanation
Initially the balances are $(1, 2, 3)$.
Operation 1: transfer from account 3 to account 1. Balances become $(2, 2, 2)$.
Operation 2: transfer from account 3 to account 2. Balances become $(2, 4, 0)$.
Now account 3 has balance $0$, so the goal is achieved.
| Sample Input 1 | Sample Output 1 |
|---|---|
1 1 2 3 |
2 3 1 3 2 |
