Chef loves bitwise operations. So, he creates the following problem but needs your help to solve it.
Chef calls a sequence of integers tasty
if it satisfies the following condition:
- for .
Chef gives you a sequence . You may perform the following operation on the sequence any number of times (possibly ):
- Choose indices and ( ; ) and change to .
Chef is asking you to make the sequence tasty
using the minimum number of operations, or report that it is impossible.
As a friendly reminder,
- denotes the remainder of dividing by
- denotes the bitwise AND operation
- denotes the bitwise OR operation
- denotes the bitwise XOR operation.
Input Format
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains a single integer .
- The second line contains space-separated integers .
Output Format
For each test case:
- If it is impossible to convert the given sequence into a
tasty
sequence using the given operations, print a single line containing the integer . - Otherwise, first, print a line containing a single integer ― the minimum number of operations you have to perform.
- Then, print lines describing these operations in the order in which you want to perform them. For each (), the -th of these lines should contain two space-separated integers and ( ; ) ― the indices on which the -th operation is performed.
If there are multiple solutions, you may find any one of them.
Constraints
- for each valid
- The sum of over all test cases does not exceed
Subtasks
Subtask #1 (100 points): Original constraints
Sample Input 1
2
2
0 0
3
6 16 69
Sample Output 1
-1
1
1 3
Explanation
Test case : It is impossible to make tasty
using the given operations.
Test case : We can choose and and apply the operation which converts into which is tasty
.
ConversionConversion EmoticonEmoticon