P15650 [CodeChef] MAKEQUAL
提高
题目描述

You are given 3 numbers A, B and C.

You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.

Find whether you can make these 3 numbers equal in finite number of moves.

------ Input Format ------

  • First line will contain T, number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, three integers A, B, and C.

------ Output Format ------

For each test case, output YES if you can make these 3 numbers equal, NO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings YES, yEs, yes, and yeS will all be treated as identical).

------ Constraints ------

$1 ≤ T ≤ 5000$
$1 ≤ A, B, C ≤ 10^{9}$

----- Sample Input 1 ------
4
4 4 3
1 6 7
3 4 3
2 3 4

----- Sample Output 1 ------
YES
YES
NO
YES

----- explanation 1 ------
Test Case $1$: It is optimal to do only $1$ operation which is adding $2^{0}$ to $C=3$. After this, all the numbers becomes equal to $4$.

Test Case $2$:
- In the first operation, add $2^{0}$ to $B=6$. Thus, numbers become $A=1, B=7,$ and $C=7$.
- In the second operation, add $2^{1}$ to $A=1$. Thus, numbers become $A=3, B=7,$ and $C=7$.
- In the third operation, add $2^{2}$ to $A=3$. Thus, numbers become $A=7, B=7,$ and $C=7$.

Thus, all the numbers become equal.

Test case $3$: It can be proven that the numbers cannot be made equal using any number of moves.

Test case $4$:
- In the first operation, add $2^{0}$ to $B=3$. Thus, numbers become $A=2, B=4,$ and $C=4$.
- In the second operation, add $2^{1}$ to $A=2$. Thus, numbers become $A=4, B=4,$ and $C=4$.

Thus, all the numbers become equal.

输入格式

见题面

输出格式

见题面

样例输入
4 4 4 3 1 6 7 3 4 3 2 3 4
样例输出
YES YES NO YES