#SL2310H. XOR Subsequence
XOR Subsequence
XOR Subsequence
Alice used to have a sequence , but she has forgotten about it now. Fortunately, she noticed that she had calculated the sum for each non-empty subsequence of the sequence and obtained results, but their order was disrupted.
Now she hopes you can help restore the sequence. If there are multiple possible sequences, please tell her the sequence with the smallest lexicographical order, or report there is no correct sequence.
Input
The first line contains a single integer , denoting the number of test cases.
For each test case, the first line contains an integer .
The next line contains non-negative integers strictly less than , denoting the results.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output one line. If there is no correct sequence, output ; otherwise, output integers denoting the answer.
Example
3
3
1 2 3 4 5 6 7
3
1 0 1 0 1 0 1
3
1 2 3 4 5 6 6
1 2 4
0 0 1
-1