#P9033. 「KDOI-04」XOR Sum
「KDOI-04」XOR Sum
Background
Kevin solved this problem at a glance.

Problem Description
Given a positive integer , construct a sequence of length consisting of non-negative integers, such that:
- For all , we have .
- , where denotes the bitwise XOR operation.
Or determine that no such sequence exists.
Input Format
This problem contains multiple test cases.
The first line of the input contains a positive integer , denoting the number of test cases.
For each test case, the input contains one line with three non-negative integers .
Output Format
For each test case, output one line with to indicate that no such sequence exists.
Otherwise, output non-negative integers separated by spaces, representing the sequence you construct. If there are multiple valid answers, you only need to output any one of them.
5
1 2 2
2 3 10
2 11 8
20 200000 99999
11 191 9810
2
4 7
8 3
-1
191 191 191 191 191 191 191 191 191 191 191
Hint
[Sample Explanation]
For the st test case, there is one and only one sequence that satisfies the conditions.
For the nd test case, since and , this is a valid answer. Similarly, the sequence is also a valid answer.
For the th test case, it can be proven that there is no sequence that meets the requirements.
[Constraints]
Let be the sum of all values within a single test point.
For all testdata, it is guaranteed that , , , and .
[Subtasks]
This problem uses bundled test cases.
- Subtask 1 (18 pts): .
- Subtask 2 (82 pts): No additional constraints.
Translated by ChatGPT 5