CF2153B.Bitwise Reversion

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Bitwise Reversion

You are given three non-negative integers xx, yy and zz. Determine whether there exist three non-negative integers aa, bb and cc satisfying the following three conditions:

  • a&b=xa \mathbin{\&} b = x
  • b&c=yb \mathbin{\&} c = y
  • a&c=za \mathbin{\&} c = z

where &\mathbin{\&} denotes the bitwise AND operation.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The first and only line of each test case contains three integers xx, yy and zz (0x,y,z1090\le x, y, z\le 10^9) — the target values of a&ba \mathbin{\&} b, b&cb \mathbin{\&} c and a&ca \mathbin{\&} c, respectively.

Output

For each test case, output "YES" if there exists three non-negative integers aa, bb, and cc satisfying the above conditions, and "NO" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Note

In the first test case, a=3a = 3, b=5b = 5, and c=9c = 9 satisfies the condition as 3&5=13 \mathbin{\&} 5 = 1, 5&9=15 \mathbin{\&} 9 = 1, and 3&9=13 \mathbin{\&} 9 = 1.

In the second test case, a=7a = 7, b=3b = 3, and c=22c = 22 satisfies the condition as 7&3=37 \mathbin{\&} 3 = 3, 3&22=23 \mathbin{\&} 22 = 2, and 7&22=67 \mathbin{\&} 22 = 6.

In the third test case, it can be proven that there are no three non-negative integers aa, bb, and cc such that a&b=4a \mathbin{\&} b = 4, b&c=8b \mathbin{\&} c = 8, and a&c=12a \mathbin{\&} c = 12.

Samples

5
1 1 1
3 2 6
4 8 12
9 10 12
12730 3088 28130
YES
YES
NO
YES
NO

在线编程 IDE

建议全屏模式获得最佳体验