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