logo AlgoBeat OnlineJudge
登录 注册

#217781. [JAG 2026 Summer Camp #1] XOR Cycle

内存限制:2048 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 , .

Here, we define . Also, denotes the bitwise XOR of and .

输入格式

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 .

输出格式

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.

样例

样例输入 1

3
2
4 7
1 0
1
0 1
1
536870912 536870912

样例输出 1

Yes
3 5
Yes
1
Yes
0