#P17527. [JAG 2026 Summer Camp #1] XOR Cycle
[JAG 2026 Summer Camp #1] XOR Cycle
Problem Description
You are given nonnegative integers .
Determine whether there exists a sequence of nonnegative integers , each less than , that satisfies the following condition. If such a sequence exists, output any one of them.
- For each , $X_i\equiv (A_i\oplus X_{i-1})+(B_i\oplus X_{i-1})\pmod{2^{30}}$.
Here, we define . Also, denotes the bitwise XOR of and .
Input Format
The input contains one or more test cases. The first line of the input contains an integer (), representing the number of test cases. The descriptions of the test cases follow, each in the following format:
N
A_1 B_1
A_2 B_2
...
A_N B_N
The first line contains an integer , representing the length of and (). For each , the -th of the following lines contains two integers and ().
The sum of over all test cases does not exceed .
Output Format
For each test case, if such a sequence exists, output Yes followed by in the following format:
Yes
X_1 X_2 ... X_N
Otherwise, output No.
If multiple sequences satisfy the condition, you may output any one of them.
3
2
4 7
1 0
1
0 1
1
536870912 536870912
Yes
3 5
Yes
1
Yes
0