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.

Source: codechef | Difficulty: HARD
Tags: Bit manipulation

Mathematics


Solutions:
def sol():
	(a, b, c) = map(int, input().split())
	for i in range(31):
		if a == b and b == c:
			return 'YES'
		bit = 1 << i
		cnt = (a & bit != 0) + (b & bit != 0) + (c & bit != 0)
		if cnt == 0 or cnt == 3:
			return 'NO'
		elif cnt == 2:
			if a & bit == 0:
				a += bit
			elif b & bit == 0:
				b += bit
			else:
				c += bit
		elif a & bit:
			a += bit
		elif b & bit:
			b += bit
		else:
			c += bit
	return 'NO'
for i in range(int(input())):
	print(sol())


n = int(input())
for _ in range(n):
	(A, B, C) = map(int, input().split())
	for i in range(33):
		if A == B == C:
			print('YES')
			break
		elif A == B < C or A == C < B or B == C < A:
			print('NO')
			break
		bit = 2 ** i
		A_bit = A & bit
		B_bit = B & bit
		C_bit = C & bit
		if A_bit == B_bit == C_bit:
			print('NO')
			break
		elif A_bit == B_bit:
			C += bit
		elif B_bit == C_bit:
			A += bit
		elif A_bit == C_bit:
			B += bit


import bisect
import os, sys, math
from io import BytesIO, IOBase
from collections import defaultdict, deque
ip = lambda : input()
it = lambda : int(input())
ma = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
MOD = 10 ** 9 + 7
MD = 998244353
mod = 100007
MIL = 1000000
inf = float('inf')
ye = 'YES'
ne = 'NO'

def diff(a, b, c):
	if a != b:
		return True
	if b != c:
		return True
	return False
for _ in range(it()):
	(a, b, c) = ma()
	ans = ye
	i = 1
	while diff(a, b, c):
		(e, f) = (min(a, b, c), max(a, b, c))
		g = a + b + c - e - f
		if e == g and e != f:
			ans = ne
			break
		w = 0
		if i & a:
			w += 1
		if i & b:
			w += 1
		if i & c:
			w += 1
		if w == 0 or w == 3:
			ans = ne
			break
		if w == 1:
			if i & a > 0:
				a += i
			elif i & b > 0:
				b += i
			else:
				c += i
			i *= 2
		else:
			if i & a == 0:
				a += i
			elif i & b == 0:
				b += i
			else:
				c += i
			i *= 2
	print(ans)


from math import log2
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mask = 1
	for i in range(int(log2(max(a, b, c))) + 2):
		if a & mask != b & mask == c & mask:
			a += mask
		elif a & mask == b & mask != c & mask:
			c += mask
		elif a & mask == c & mask != b & mask:
			b += mask
		else:
			break
		mask <<= 1
	print(['NO', 'YES'][a == b == c])


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mask = 1
	for i in range(64):
		if a & mask != b & mask == c & mask:
			a += mask
		elif b & mask != a & mask == c & mask:
			b += mask
		elif c & mask != b & mask == a & mask:
			c += mask
		else:
			break
		mask <<= 1
	if a == b == c:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
from collections import Counter
import math
import bisect

class dsu:

	def __init__(self):
		self.parent = defaultdict(int)
		self.size = [0] * (n + 1)

	def start(self):
		for i in range(1, n + 1):
			self.parent[i] = i

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u != v:
			self.parent[v] = u

	def treeinput(self, m):
		for i in range(m):
			(u, v) = map(int, input().split())
			self.union(u, v)

	def printt(self):
		print(self.parent)

def setbit(arr):
	mask = 1
	bit = [0] * 32
	for i in range(32):
		for k in arr:
			if k & mask:
				bit[i] += 1
		mask <<= 1
	return bit

def prefix_sum(nums):
	prefix = [0]
	for i in range(len(nums)):
		prefix.append(prefix[-1] + nums[i])
	return prefix

def mx_lensubarray(nums):
	res = 0
	j = 0
	mp = defaultdict(int)
	prefix = prefixsum(nums)
	mxSum = 0
	for i in range(len(nums)):
		if nums[i] in mp:
			temp = mp[nums[i]]
		else:
			temp = 0
		j = max(temp, j)
		mp[nums[i]] = i + 1
		res = max(res, i - j + 1)
		mxSum = max(mxSum, prefix[i + 1] - prefix[j])
	return res

def lenOfLongSubarr(self, A, N, k):
	mp = {}
	sm = 0
	mxlen = 0
	for i in range(N):
		sm += A[i]
		if sm == k:
			mxlen = i + 1
		if sm - k in mp:
			mxlen = max(mxlen, i - mp[sm - k])
		if sm not in mp:
			mp[sm] = i
	return mxlen

def no_of_factor(s):
	while i <= s ** 0.5:
		if not s % i:
			cnt = cnt + 1 if s / i == i else cnt + 2
	i += 1
	return cnt

def primes(n):
	arr = []
	i = 2
	while i * i <= n:
		if not n % i:
			cnt = 0
			while not n % i:
				cnt += 1
				n //= i
			arr.append([i, cnt])
		i += 1
	if n > 1:
		arr.append([n, 1])
	return arr

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	res = []
	for i in range(2, n + 1):
		if prime[i]:
			res.append(i)
	return res

def treeinput():
	adj = [[] for i in range(n + 1)]
	for i in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u].append(v)
		adj[v].append(u)

def dfs_size(node, parent):
	sum_size[node] = 1
	for child in adj[node]:
		if child != parent:
			dfs_size(child, node)
			sum_size[node] += sum_size[child]

def anda(arr):
	res = arr[0]
	for i in arr:
		res &= i
	return res

def ora(arr):
	res = arr[0]
	for i in arr:
		res |= i
	return res

def xora(arr):
	res = 0
	for i in arr:
		res ^= i
	return res
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mask = 1
	for i in range(64):
		if a & mask != b & mask == c & mask:
			a += mask
		elif b & mask != a & mask == c & mask:
			b += mask
		elif c & mask != b & mask == a & mask:
			c += mask
		else:
			break
		mask <<= 1
	if a == b == c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	isSame = False
	for i in range(40):
		if a == b and b == c:
			isSame = True
			break
		(x, y, z) = (a >> i & 1, b >> i & 1, c >> i & 1)
		bitSum = x + y + z
		if bitSum == 2:
			if not x:
				a += 1 << i
			if not y:
				b += 1 << i
			if not z:
				c += 1 << i
		elif bitSum == 1:
			if x:
				a += 1 << i
			if y:
				b += 1 << i
			if z:
				c += 1 << i
		else:
			break
	if isSame:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(a, b, c) = map(int, input().split())
	poss = False
	for i in range(40):
		if a == b and b == c:
			poss = True
			break
		ct = (a >> i & 1) + (b >> i & 1) + (c >> i & 1)
		if ct == 2:
			if a >> i & 1 == 0:
				a += 1 << i
			if b >> i & 1 == 0:
				b += 1 << i
			if c >> i & 1 == 0:
				c += 1 << i
		elif ct == 1:
			if a >> i & 1:
				a += 1 << i
			if b >> i & 1:
				b += 1 << i
			if c >> i & 1:
				c += 1 << i
		else:
			break
	if poss:
		print('YES')
	else:
		print('NO')
	t -= 1


def bits(a, bit):
	if a & bit > 0:
		return 1
	else:
		return 0
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	flag = True
	for i in range(31):
		if a == b == c:
			break
		bit = 1 << i
		cnt = bits(a, bit) + bits(b, bit) + bits(c, bit)
		if cnt == 0 or cnt == 3:
			flag = False
			break
		elif cnt == 1:
			if a & bit > 0:
				a += bit
			elif b & bit > 0:
				b += bit
			else:
				c += bit
		elif a & bit == 0:
			a += bit
		elif b & bit == 0:
			b += bit
		else:
			c += bit
		if a & bit != b & bit and a & bit != c & bit:
			flag = False
			break
	if flag and a == b and (b == c):
		print('YES')
	else:
		print('NO')


def solve(a, b, c):
	flag = True
	for i in range(0, 31):
		if a == b and b == c:
			break
		x = 1 << i
		cnt = (x & a != 0) + (x & b != 0) + (x & c != 0)
		if cnt == 0 or cnt == 3:
			flag = False
			break
		elif cnt == 1:
			if x & a:
				a += x
			elif x & b:
				b += x
			else:
				c += x
		elif x & a == 0:
			a += x
		elif x & b == 0:
			b += x
		else:
			c += x
	if flag and a == b and (b == c):
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	solve(a, b, c)


from math import ceil
t = int(input())
for _ in range(t):
	num = list(map(int, input().split()))
	if num == [num[0]] * 3:
		print('YES')
	else:
		bin_num = [list(bin(el)[2:]) for el in num]
		bin_num = [list(map(int, n)) for n in bin_num]
		mx = 0
		for bn in bin_num:
			mx = max(mx, len(bn))
		mx += 1
		for i in range(3):
			bin_num[i] = [0] * (mx - len(bin_num[i])) + bin_num[i]
		flag = True
		for i in range(mx - 1, -1, -1):
			if bin_num == [bin_num[0]] * 3:
				break
			bits = [el[i] for el in bin_num]
			if bits.count(1) % 3 == 0 or (i == 0 and bits.count(1) == 1):
				flag = False
				break
			elif bits.count(1) == 1:
				ind = bits.index(1)
				for j in range(i, -1, -1):
					bin_num[ind][j] = (bin_num[ind][j] + 1) % 2
					if bin_num[ind][j]:
						break
			else:
				ind = bits.index(0)
				bin_num[ind][i] = 1
		if flag:
			print('YES')
		else:
			print('NO')


import fileinput
with fileinput.input() as f:
	t = int(f.readline().strip())
	for i in range(t):
		(a, b, c) = [int(e) for e in f.readline().strip().split(' ', 2)]
		while int(a == 0) + int(b == 0) + int(c == 0) < 2:
			r = a % 2 + b % 2 + c % 2
			if r == 0 or r == 3:
				break
			elif r == 1:
				if a % 2 == 1:
					a += 1
				elif b % 2 == 1:
					b += 1
				elif c % 2 == 1:
					c += 1
			elif r == 2:
				if a % 2 == 0:
					a += 1
				elif b % 2 == 0:
					b += 1
				elif c % 2 == 0:
					c += 1
			a //= 2
			b //= 2
			c //= 2
		if a == b == c:
			print('YES')
		else:
			print('NO')


def set_bit(x, i):
	if 1 << i & x:
		return 1
	return 0
for _ in range(int(input())):
	nums = list(map(int, input().split()))
	flag = 1
	for i in range(31):
		if len(set(nums)) == 1:
			print('YES')
			flag = 0
			break
		bit_sum = sum((set_bit(n, i) for n in nums))
		if bit_sum == 3 or bit_sum == 0:
			flag = 1
			break
		elif bit_sum == 1:
			for x in range(3):
				if set_bit(nums[x], i):
					nums[x] += 1 << i
		else:
			for x in range(3):
				if not set_bit(nums[x], i):
					nums[x] += 1 << i
	if flag:
		print('NO')


def solve(a, b, c):
	temp = True
	for i in range(0, 31):
		if a == b and b == c:
			break
		bit = 1 << i
		count = (bit & a != 0) + (bit & b != 0) + (bit & c != 0)
		if count == 0 or count == 3:
			temp = False
			break
		elif count == 1:
			if bit & a:
				a += bit
			elif bit & b:
				b += bit
			else:
				c += bit
		elif bit & a == 0:
			a += bit
		elif bit & b == 0:
			b += bit
		else:
			c += bit
	if temp and a == b and (b == c):
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	print(solve(a, b, c))


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	flag = False
	for i in range(40):
		if a == b and c == b:
			flag = True
		else:
			(p, q, r) = (a >> i & 1, b >> i & 1, c >> i & 1)
			if p + q + r == 2:
				if not p:
					a += 1 << i
				if not q:
					b += 1 << i
				if not r:
					c += 1 << i
			elif p + q + r == 1:
				if p == 1:
					a += 1 << i
				elif q == 1:
					b += 1 << i
				elif r == 1:
					c += 1 << i
			else:
				break
	if a == b and c == b:
		flag = True
	else:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(a, b, c) = map(int, input().strip().split(' '))
	if a == b == c:
		print('YES')
		continue
	f = 0
	for i in range(31):
		if a == b and b == c:
			f = 1
			break
		bit = 1 << i
		cnt = (bit & a != 0) + (bit & b != 0) + (bit & c != 0)
		if cnt == 0 or cnt == 3:
			break
		elif cnt == 2:
			if bit & a == 0:
				a += bit
			elif bit & b == 0:
				b += bit
			else:
				c += bit
		elif bit & a:
			a += bit
		elif bit & b:
			b += bit
		else:
			c += bit
	if f == 1 and (a == b and b == c):
		print('YES')
	else:
		print('NO')


def ff(arr):
	ans = 0
	for i in range(len(arr)):
		ans += arr[i] * 2 ** i
	return ans

def convert(n):
	arr = []
	while n > 0:
		r = n % 2
		arr.append(r)
		n >>= 1
	return arr

def f(arr, n):
	while len(arr) < n:
		arr.append(0)

def ad(ar, br, cr, x):
	c = 1
	while x != len(ar) and c != 0:
		tm = ar[x] + c
		if tm == 1:
			ar[x] = 1
			c = 0
		else:
			ar[x] = 0
			c = 1
		x += 1
	if c != 0:
		ar.append(c)
		br.append(0)
		cr.append(0)
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	if a <= 0 or b <= 0 or c <= 0:
		print('NO')
		continue
	ar = convert(a)
	br = convert(b)
	cr = convert(c)
	s = max(len(ar), len(br), len(cr))
	f(ar, s)
	f(br, s)
	f(cr, s)
	ch = False
	ans = True
	i = 0
	while i < len(ar) - 1:
		tm = ar[i] + br[i] + cr[i]
		if ch and (tm == 1 or tm == 2):
			ans = False
			break
		if tm == 1:
			if ar[i] == 1:
				ad(ar, br, cr, i)
			elif br[i] == 1:
				ad(br, ar, cr, i)
			elif cr[i] == 1:
				ad(cr, ar, br, i)
		elif tm == 2:
			if ar[i] == 0:
				ad(ar, br, cr, i)
			elif br[i] == 0:
				ad(br, ar, cr, i)
			elif cr[i] == 0:
				ad(cr, ar, br, i)
		else:
			ch = True
		i += 1
	x = len(ar)
	tm = ar[x - 1] + br[x - 1] + cr[x - 1]
	if tm == 1:
		ans = False
	elif tm == 2 and ch == False:
		if ar[x - 1] == 0:
			ar[x - 1] = 1
		if br[x - 1] == 0:
			br[x - 1] = 1
		if cr[x - 1] == 0:
			cr[x - 1] = 1
	if ans and ar[x - 1] == br[x - 1] == cr[x - 1]:
		print('YES')
	else:
		print('NO')


import sys
import math
from collections import defaultdict, Counter, deque
from bisect import *
from string import ascii_lowercase
from heapq import *

def readInts():
	x = list(map(int, sys.stdin.readline().rstrip().split()))
	return x[0] if len(x) == 1 else x

def readList(type=int):
	x = sys.stdin.readline()
	x = list(map(type, x.rstrip('\n\r').split()))
	return x

def readStr():
	x = sys.stdin.readline().rstrip('\r\n')
	return x
write = sys.stdout.write
read = sys.stdin.readline
MAXN = 1123456

def dist(x1, x2, y1, y2):
	return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

def mergeSort(arr, check=lambda a, b: a < b, reverse=False):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L, check, reverse)
		mergeSort(R, check, reverse)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if check(L[i], R[j]):
				if not reverse:
					arr[k] = L[i]
					i += 1
				else:
					arr[k] = R[j]
					j += 1
			elif not reverse:
				arr[k] = R[j]
				j += 1
			else:
				arr[k] = L[i]
				i += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1

def maxSum(arr, k):
	max_sum = 0
	max_cur = 0
	for (i, num) in enumerate(arr):
		max_cur = max(max_cur + num, num)
		if max_cur > max_sum:
			max_sum = max_cur
	return max_sum

def lcm(a, b):
	return a * b // math.gcd(a, b)

def get_power(n, m):
	i = 1
	p = -1
	while i <= n:
		i = i * m
		p += 1
	return p

def fact(n):
	f = 1
	for i in range(2, n + 1):
		f *= i
	return f

def find_closest(num, ar):
	min_d = float('inf')
	for num2 in ar:
		d = abs(num2 - num)
		if d < min_d:
			min_d = d
	return min_d

def check_pal(n):
	s = str(n)
	j = len(s) - 1
	i = 0
	while j > i:
		if s[i] != s[j]:
			return False
		i += 1
		j -= 1
	return True

def get_primes():
	primes = [False for _ in range(MAXN + 1)]
	used = [False for _ in range(MAXN + 1)]
	for i in range(2, MAXN + 1):
		if not used[i]:
			primes[i] = True
			for j in range(i, MAXN + 1, i):
				used[j] = True
	return primes

def isPrime(primes, n):
	if primes[n]:
		return True
	return False

def solve(t, primes=None):
	(a, b, c) = readInts()
	cur = 1
	for _ in range(31):
		cnt = 0
		if a & cur:
			cnt += 1
		if b & cur:
			cnt += 1
		if c & cur:
			cnt += 1
		if cnt == 1:
			if a & cur:
				a += cur
			elif b & cur:
				b += cur
			else:
				c += cur
		elif cnt == 2:
			if not a & cur:
				a += cur
			elif not b & cur:
				b += cur
			else:
				c += cur
		else:
			break
		cur = cur << 1
	if a == b and b == c:
		print('YES')
	else:
		print('NO')

def main():
	t = 1
	t = readInts()
	for i in range(t):
		solve(i + 1)
main()


for n in [list(map(int, l.split())) for l in open(0)][1:]:
	for i in range(30):
		(k, l, m) = map(lambda x: x % 2, n)
		if k == l == m:
			continue
		if [k, l, m].count(0) == 1:
			n[[k, l, m].index(0)] += 1
		if [k, l, m].count(1) == 1:
			n[[k, l, m].index(1)] += 1
		for i in range(3):
			n[i] >>= 1
	(a, b, c) = n
	print('YES' if a == b == c else 'NO')


from collections import *
N = 35
for _ in range(int(input())):
	n = list(map(int, input().split()))
	for i in range(N):
		(k, l, m) = map(lambda x: x % 2, n)
		if k == l == m:
			continue
		if [k, l, m].count(1) > 1:
			n[[k, l, m].index(0)] += 1
		if [k, l, m].count(0) > 1:
			n[[k, l, m].index(1)] += 1
		for i in range(3):
			n[i] >>= 1
	(a, b, c) = n
	print('YES' if a == b == c else 'NO')


import math
for i in range(int(input())):
	(A, B, C) = map(int, input().split())
	flag = 0
	if A == B and B == C:
		flag = 1
	else:
		for k in range(1, 61):
			temp = 2 ** k - 1
			x = A + B + C + temp
			if x % 3 != 0:
				continue
			else:
				x //= 3
				temp1 = x - A
				temp2 = x - B
				temp3 = x - C
				temp4 = temp1 ^ temp2 ^ temp3
				mx = max([A, B, C])
				if x >= mx and temp4 == temp:
					flag = 1
					break
	if flag == 1:
		print('YES')
	else:
		print('NO')


from math import gcd
pows = [2 ** i for i in range(31)]

def solve():
	arr = list(map(int, input().split()))
	arr.sort()
	(a, b, c) = (arr[0], arr[1], arr[2])
	ans = False

	def check(a, b, c, m):
		a = m - a
		b = m - b
		c = m - c
		if b & a == 0 and a & c == 0 and (b & c == 0):
			return True
		return False

	def heck(a, b, c, m):
		a = m - a
		b = m - b
		c = m - c
		if b & a == 0 and a & c == 0 and (b & c == 0):
			return True
		return False

	def ck(a, b, c, m):
		a = m - a
		b = m - b
		c = m - c
		if b & a == 0 and a & c == 0 and (b & c == 0):
			return True
		return False
	for i in range(31):
		curr = sum(arr) + pows[i] - 1
		if curr % 3 == 0:
			if check(a, b, c, curr // 3):
				ans = True
	if ans:
		print('YES')
	else:
		print('NO')
try:
	for tc in range(int(input())):
		solve()
except EOFError:
	pass


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = True
	ar = True
	while True:
		if a == b and b == c:
			break
		cnt = 0
		zer = 0
		if a == 0:
			cnt += 1
			zer += 1
		if b == 0:
			cnt += 1
			zer += 1
		if c == 0:
			cnt += 1
			zer += 1
		if cnt == 3:
			break
		elif zer == 2:
			ans = False
			break
		if a % 2 == 0:
			aval = 0
		else:
			aval = 1
		if b % 2 == 0:
			bval = 0
		else:
			bval = 1
		if c % 2 == 0:
			cval = 0
		else:
			cval = 1
		if aval == bval and bval == cval:
			ans = False
			break
		elif cval == 0 and bval == 0:
			a += 1
		elif bval == 0 and aval == 0:
			c += 1
		elif cval == 0 and aval == 0:
			b += 1
		a = a >> 1
		b = b >> 1
		c = c >> 1
	if ans:
		print('YES')
	else:
		print('NO')


import atexit, io, sys, math, heapq, collections
from re import I
from importlib.util import find_spec
from turtle import clear

def get_int():
	return int(sys.stdin.readline().strip())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def write_int(a):
	sys.stdout.write(str(a) + '\n')

def write_str(a):
	sys.stdout.write(a + '\n')

def write_list(arr):
	sys.stdout.write(' '.join(map(str, arr)) + '\n')

def swap(arr, a, b):
	arr[a] ^= arr[b]
	arr[b] ^= arr[a]
	arr[a] ^= arr[b]

def int_len(a):
	return math.floor(math.log(a, 10)) + 1

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	res = []
	for i in range(2, len(prime)):
		if prime[i]:
			res.append(i)
	return res

def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1

def search(arr, x):
	return binarySearch(arr, 0, len(arr) - 1, x)

def toString(A):
	return ''.join(A)

def toArray(str):
	return str.split()

def arrSum(Arr):
	Sum = 0
	for i in range(len(Arr)):
		Sum += Arr[i]
	return Sum

def computeXOR(n):
	if n % 4 == 0:
		return n
	if n % 4 == 1:
		return 1
	if n % 4 == 2:
		return n + 1
	return 0

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isSubSequence(string1, string2, m, n):
	if m == 0:
		return True
	if n == 0:
		return False
	if string1[m - 1] == string2[n - 1]:
		return isSubSequence(string1, string2, m - 1, n - 1)
	return isSubSequence(string1, string2, m, n - 1)

def Sum(a, b):
	if b.find('-') != -1:
		return '-1'
	L1 = len(a)
	L2 = len(b)
	res = ''
	if L1 < L2:
		a = '0' * (L2 - L1) + a
	elif L2 < L1:
		b = '0' * (L1 - L2) + b
	for i in range(0, max(L1, L2)):
		s = a[i]
		t = b[i]
		p = int(a[i]) + int(b[i])
		res += str(p)
	return res

def isPalin(s):
	return s == s[::-1]

def nextPermutation(nums):
	i = len(nums) - 1
	flag = True
	while i >= 1:
		if nums[i] > nums[i - 1]:
			i -= 1
			flag = False
			break
		i -= 1
	if i == 0 and flag:
		nums.reverse()
	else:
		diff = 10000000
		index = i
		j = i
		while j < len(nums):
			if nums[j] > nums[i] and diff >= nums[j] - nums[i]:
				index = j
				diff = nums[j] - nums[i]
			j += 1
		temp = nums[index]
		nums[index] = nums[i]
		nums[i] = temp
		nums[i + 1:] = reversed(nums[i + 1:])
	return nums

def pairs(arr, size, n):
	mpp = {}
	for i in range(size):
		if arr[i] in mpp.keys():
			mpp[arr[i]] += 1
		else:
			mpp[arr[i]] = 1
	for i in range(size):
		if n + arr[i] in mpp.keys():
			return True
	return False

def lps(s):
	a = s[-1]
	if len(s) == 1:
		return 0
	elif len(s) == 2:
		if s[0] == s[1]:
			return 1
		return 0
	k = len(s) - 2
	while k >= 0:
		if s[k] == s[-1]:
			if s[:k + 1] == s[len(s) - k - 1:]:
				return k + 1
		k -= 1
	return 0

def check(arr):
	i = 0
	for i in range(len(arr) - 1):
		if arr[i] % 2 != arr[i + 1] % 2:
			return False
	return True

def get_sum(mat, x, y):
	Sum = mat[x][y]
	i = x + 1
	j = y + 1
	while i < len(mat) and j < len(mat[0]):
		Sum += mat[i][j]
		i += 1
		j += 1
	i = x + 1
	j = y - 1
	while i < len(mat) and j >= 0:
		Sum += mat[i][j]
		i += 1
		j -= 1
	i = x - 1
	j = y - 1
	while i >= 0 and j >= 0:
		Sum += mat[i][j]
		i -= 1
		j -= 1
	i = x - 1
	j = y + 1
	while i >= 0 and j < len(mat[0]):
		Sum += mat[i][j]
		i -= 1
		j += 1
	return Sum

def get_diff(A, B):
	ans = 0
	for i in range(len(A)):
		a = ord(A[i])
		b = ord(B[i])
		if a > b:
			ans += a - b
		else:
			ans += b - a
	return ans

def get_min(L, q):
	low = 0
	high = len(L) - 1
	ans = high
	while low <= high:
		mid = (low + high) // 2
		if L[mid] >= q:
			ans = min(mid, ans)
			high = mid - 1
		else:
			low = mid + 1
	return ans

def find_cons(L):
	low = 0
	ans = -1
	i = 1
	while i < len(L):
		res = 0
		m = L[i - 1]
		flag = True
		while i < len(L) and L[i] - L[i - 1] == 1:
			flag = False
			res += 1
			i += 1
		if ans < res:
			low = m
			ans = res
		i += 1
	return (ans, low)

def gcd(a, b):
	if a == b:
		return a
	if a == 0:
		return b
	if b == 0:
		return a
	if ~a & 1 == 1:
		if b & 1 == 1:
			return gcd(a >> 1, b)
		else:
			return gcd(a >> 1, b >> 1) << 1
	if ~b & 1 == 1:
		return gcd(a, b >> 1)
	if a > b:
		return gcd(a - b >> 1, b)
	return gcd(b - a >> 1, a)

def countDivisors(n):
	i = 1
	count = 0
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				count += 1
			else:
				count += 2
		i = i + 1
	return count

def check(mat, x, y):
	A = [1, -1, 1, -1]
	B = [-1, 1, 1, -1]
	flag = True
	for i in range(4):
		if x + A[i] < 8 and y + B[i] < 8 and (x + A[i] >= 0) and (y + B[i] >= 0):
			if mat[x + A[i], y + A[i]] != '#':
				flag = False
	return flag

def update(bits, i, Max, v):
	l = 0
	while v != 0:
		if v & 1 == 1:
			bits[i][l] = 1
		else:
			bits[i][l] = 0
		if l > Max:
			Max = l
		v = v >> 1
		l += 1
	return Max
N = get_int()
while N > 0:
	bits = []
	for i in range(3):
		bits.append([0] * 60)
	arr = get_list()
	n = 3
	Max = 0
	while n > 0:
		v = arr[n - 1]
		i = 0
		while v != 0:
			if v & 1 == 1:
				bits[n - 1][i] += 1
				if i > Max:
					Max = i
			v = v >> 1
			i += 1
		n -= 1
	n = 0
	while n <= Max + 1:
		if bits[0][n] == 0 and bits[1][n] == 0 and (bits[2][n] == 0):
			break
		elif bits[0][n] == 0 and bits[1][n] == 0 and (bits[2][n] == 1):
			arr[2] += 1 << n
			update(bits, 2, Max, arr[2])
		elif bits[0][n] == 0 and bits[1][n] == 1 and (bits[2][n] == 0):
			arr[1] += 1 << n
			update(bits, 1, Max, arr[1])
		elif bits[0][n] == 0 and bits[1][n] == 1 and (bits[2][n] == 1):
			arr[0] += 1 << n
			update(bits, 0, Max, arr[0])
		elif bits[0][n] == 1 and bits[1][n] == 0 and (bits[2][n] == 0):
			arr[0] += 1 << n
			update(bits, 0, Max, arr[0])
		elif bits[0][n] == 1 and bits[1][n] == 0 and (bits[2][n] == 1):
			arr[1] += 1 << n
			update(bits, 1, Max, arr[1])
		elif bits[0][n] == 1 and bits[1][n] == 1 and (bits[2][n] == 0):
			arr[2] += 1 << n
			update(bits, 2, Max, arr[2])
		elif bits[0][n] == 1 and bits[1][n] == 1 and (bits[2][n] == 1):
			break
		n += 1
	if arr[1] == arr[2] and arr[1] == arr[0]:
		print('YES')
	else:
		print('NO')
	N -= 1


from math import ceil
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	(s1, s2, s3) = (list(bin(a)[2:]), list(bin(b)[2:]), list(bin(c)[2:]))
	l = sorted([len(s1), len(s2), len(s3)])
	extra = ['0'] * (l[-1] - l[0] + 4)
	s1 = (extra + s1)[-l[-1] - 2:]
	s2 = (extra + s2)[-l[-1] - 2:]
	s3 = (extra + s3)[-l[-1] - 2:]

	def carry(a, i):
		for p in range(i, -1, -1):
			if a[p] == '0':
				a[p] = '1'
				return a
			else:
				a[p] = '0'
	ans = 'YES'
	for i in range(l[-1] + 1, 0, -1):
		temp = int(s1[i]) + int(s2[i]) + int(s3[i])
		if s1 == s2 == s3:
			break
		if temp == 3 or temp == 0:
			ans = 'NO'
			break
		elif temp == 2:
			if s1[i] == '0':
				s1[i] = '1'
			elif s2[i] == '0':
				s2[i] = '1'
			else:
				s3[i] = '1'
		elif s1[i] == '1':
			carry(s1, i)
			s1[i] = '0'
		elif s2[i] == '1':
			carry(s2, i)
			s2[i] = '0'
		else:
			s3 = carry(s3, i)
	if int(s1[0]) + int(s2[0]) + int(s3[0]) != 0:
		ans = 'NO'
	print(ans)


from math import gcd
pows = [2 ** i for i in range(31)]

def answer():
	ary = list(map(int, input().split()))
	ary.sort()
	(a, b, c) = (ary[0], ary[1], ary[2])
	solution = False

	def how(a, b, c, m):
		a = m - a
		b = m - b
		c = m - c
		if b & a == 0 and a & c == 0 and (b & c == 0) and (8 == 8):
			return True
		return False
	for i in range(31):
		cunt = sum(ary) + pows[i] - 1
		if cunt % 3 == 0:
			if how(a, b, c, cunt // 3):
				solution = True
	if solution:
		print('YES')
	else:
		print('NO')
try:
	for tc in range(int(input())):
		answer()
except EOFError:
	pass


import sys
input = sys.stdin.readline
M = int(1000000000.0) + 7

def solve():
	l = list(map(int, input().split()))
	while l[1] != 0:
		ev = 0
		for num in l:
			ev += num % 2 == 0
		if ev == 0 or ev == 3:
			break
		if ev == 2:
			for i in range(3):
				if l[i] % 2 == 1:
					l[i] += 1
		for i in range(3):
			l[i] //= 2
		l.sort()
	if len(set(l)) == 1:
		return 'YES'
	return 'NO'
for _ in range(int(input())):
	print(solve())


import math
for _ in range(int(input())):
	aa = list(map(int, input().split()))
	(a, b, c) = sorted(aa)
	ans = []
	ok = False
	s = sum(aa)
	for i in range(35):
		x = s + 2 ** i - 1
		if x % 3 == 0:
			ans.append([x // 3, i])
	for x in ans:
		xx = x[0]
		i = x[1]
		a1 = xx - a
		b1 = xx - b
		c1 = xx - c
		if a1 & b1 == 0 and a1 & c1 == 0 and (b1 & c1 == 0):
			ok = True
	if ok:
		print('YES')
	else:
		print('NO')


import math

def setbit(a):
	return a >> 1

def correct(a):
	if a == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
while t > 0:
	t = t - 1
	(a, b, c) = map(int, input().split())
	i = 1
	chk = 1
	while True:
		j = 0
		for i in range(1, 2):
			j = j & i
		if a == b and b == c:
			break
		res = 0
		if a == 0:
			res = res + 1
		if b == 0:
			res = res + 1
		if c == 0:
			res = res + 1
		if res == 3:
			break
		elif res == 2:
			chk = 0
			break
		x = a & 1
		y = b & 1
		z = c & 1
		gm = 6
		if x == y and y == z:
			if gm == 6:
				chk = 0
				break
		elif x == 0 and y == 0:
			if gm == 6:
				c = c + 1
		elif y == 0 and z == 0:
			if gm == 6:
				a = a + 1
		elif x == 0 and z == 0:
			if gm == 6:
				b = b + 1
		a = setbit(a)
		b = setbit(b)
		c = setbit(c)
	if chk == 1:
		correct(1)
	else:
		correct(0)


n = int(input())

def comp(x, y, z):
	l = [x, y, z]
	l.sort()
	x = l[2]
	y = l[1]
	z = l[0]
	if x == y == z:
		return 'YES'
	if y == z or x % 2 == y % 2 == z % 2:
		return 'NO'
	if x % 2 + y % 2 + z % 2 == 1:
		if x % 2 == 1:
			x = x + 1
		if y % 2 == 1:
			y = y + 1
		if z % 2 == 1:
			z = z + 1
	return comp(x // 2, y // 2, z // 2)
for i in range(n):
	(x, y, z) = map(int, input().split())
	print(comp(x, y, z))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 0
	v = 1
	for i in range(33):
		if a == b and b == c:
			ans = 1
			break
		elif a & v == b & v and b & v == c & v:
			break
		elif a & v == b & v:
			c += v
		elif a & v == c & v:
			b += v
		else:
			a += v
		v *= 2
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())

def getbits(n):
	ans = []
	while n > 0:
		ans.append(n % 2)
		n = n // 2
while t > 0:
	t = t - 1
	(a, b, c) = list(map(int, input().split()))
	ans = 'YES'
	while a > 0 or b > 0 or c > 0:
		if a == b == c:
			break
		if a < 2 and b < 2 and (c < 2):
			if a + b + c == 1:
				ans = 'NO'
				break
			else:
				break
		if a % 2 + b % 2 + c % 2 == 2:
			a = a // 2
			b = b // 2
			c = c // 2
		elif a % 2 + b % 2 + c % 2 == 1:
			a = (a + a % 2) // 2
			b = (b + b % 2) // 2
			c = (c + c % 2) // 2
		else:
			ans = 'NO'
			break
	print(ans)


import math

def addToOddOneOut(l, val):
	if l[0] == l[1] and l[1] < l[2]:
		return None
	if l[0] == l[2] and l[2] < l[1]:
		return None
	if l[2] == l[1] and l[1] < l[0]:
		return None
	oddOne = None
	b0 = bin(l[0])[2:]
	b1 = bin(l[1])[2:]
	b2 = bin(l[2])[2:]
	b0 = '0' * 30 + b0
	b1 = '0' * 30 + b1
	b2 = '0' * 30 + b2
	pos = -1 * (val + 1)
	if b0[pos] == b1[pos] and b0[pos] != b2[pos]:
		oddOne = 2
	elif b0[pos] != b1[pos] and b0[pos] == b2[pos]:
		oddOne = 1
	elif b0[pos] != b1[pos] and b0[pos] != b2[pos]:
		oddOne = 0
	if oddOne != None:
		l[oddOne] += 2 ** val
		return l
	else:
		return None
t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	val = 0
	equal = False
	while l and (not equal):
		equal = l[0] == l[1] and l[1] == l[2]
		l = addToOddOneOut(l, val)
		val += 1
	if equal:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	bits = [[0 for _ in range(64)] for _ in range(3)]
	for i in range(32):
		if a & 1 << i:
			bits[0][i] += 1
		if b & 1 << i:
			bits[1][i] += 1
		if c & 1 << i:
			bits[2][i] += 1
	if a == b == c:
		print('YES')
		continue
	ans = 'YES'
	for i in range(64):
		if bits[0][i] == bits[1][i] == bits[2][i]:
			if bits[0] == bits[1] == bits[2]:
				print('YES')
				break
			else:
				print('NO')
				break
		if bits[0][i] == 0:
			if bits[1][i] == 0:
				bits[2][i] = 0
				try:
					j = i + 1
					while bits[2][j] != 0:
						bits[2][j] = 0
						j += 1
					bits[2][j] = 1
				except:
					print('NO')
			elif bits[2][i] == 0:
				bits[1][i] = 0
				try:
					j = i + 1
					while bits[1][j] != 0:
						bits[1][j] = 0
						j += 1
					bits[1][j] = 1
				except:
					print('NO')
			else:
				bits[0][i] = 1
		elif bits[1][i] == 0:
			if bits[2][i] == 0:
				bits[0][i] = 0
				try:
					j = i + 1
					while bits[0][j] != 0:
						bits[0][j] = 0
						j += 1
					bits[0][j] = 1
				except:
					print('NO')
			else:
				bits[1][i] = 1
		else:
			bits[2][i] = 1


t = int(input())
for i in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	x = a
	y = b
	z = c
	i = 0
	while x and z or (y and x) or (y and z):
		if a == b and b == c:
			break
		if a & 1 << i != 0 and b & 1 << i != 0 and (c & 1 << i == 0):
			c += 1 << i
			z += 1
		elif a & 1 << i == 0 and b & 1 << i != 0 and (c & 1 << i != 0):
			a += 1 << i
			x += 1
		elif a & 1 << i != 0 and b & 1 << i == 0 and (c & 1 << i != 0):
			b += 1 << i
			y += 1
		elif a & 1 << i != 0 and b & 1 << i == 0 and (c & 1 << i == 0):
			a += 1 << i
			x += 1
		elif a & 1 << i == 0 and b & 1 << i != 0 and (c & 1 << i == 0):
			b += 1 << i
			y += 1
		elif a & 1 << i == 0 and b & 1 << i == 0 and (c & 1 << i != 0):
			c += 1 << i
			z += 1
		else:
			break
		if a == b and b == c:
			break
		x >>= 1
		y >>= 1
		z >>= 1
		i += 1
	if a == b and b == c:
		print('YES')
	else:
		print('NO')


def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return str(input())

def ni():
	return int(input())
for T in range(int(input())):
	(a, b, c) = mi()
	for i in range(32):
		(x, y, z) = (a & 1 << i, b & 1 << i, c & 1 << i)
		if x != y and x != z:
			a += 2 ** i
		elif y != x and y != z:
			b += 2 ** i
		elif z != x and z != y:
			c += 2 ** i
		else:
			break
	if a == b == c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	c1 = 0
	f = 0
	while c1 < 32:
		if a == b and b == c:
			print('YES')
			f = 1
			break
		val = 1 << c1
		f1 = a & val
		f2 = b & val
		f3 = c & val
		if f1 == f2 and f2 == f3:
			print('NO')
			f = 1
			break
		elif f1 == f2:
			c = c + val
		elif f1 == f3:
			b = b + val
		else:
			a = a + val
		c1 += 1
	if f == 0:
		print('NO')


def solve(_in):
	if _in[0] == _in[1] and _in[0] == _in[2]:
		return 'YES'
	_in.sort()
	if _in[0] == 0:
		if _in[1] == 0:
			return 'NO'
	Sum = sum(_in)
	remainders = [x % 2 for x in _in]
	if Sum % 3 in [0, 2] and sum(remainders) in [1, 2]:
		if sum(remainders) == 1:
			i = remainders.index(1)
		else:
			i = remainders.index(0)
		_in[i] += 1
		_in[1] = (_in[1] - _in[0]) // 2
		_in[2] = (_in[2] - _in[0]) // 2
		_in[0] = 0
		return solve(_in)
	else:
		return 'NO'
for _ in range(int(input())):
	_in = list(map(int, input().split()))
	print(solve(_in))


def fun(ar, i, nar, lar):
	newar = ''
	if nar == 1:
		if i < lar:
			c = 1
			for x in range(i, lar):
				if ar[x] == 0:
					newar += '1'
					c = 0
					for j in range(x + 1, lar):
						newar += str(ar[j])
					break
				else:
					newar += '0'
			if c == 1:
				newar += '1'
		else:
			newar = '1'
	else:
		for x in range(i, lar):
			newar += str(ar[x])
	return newar

def update(a, b, c, i, na, nb, nc, la, lb, lc):
	newa = fun(a, i, na, la)
	newb = fun(b, i, nb, lb)
	newc = fun(c, i, nc, lc)
	if newa == newb and newb == newc:
		return True
	return False
for t in range(int(input())):
	(a, b, c) = list((bin(int(i))[2:][::-1] for i in input().split()))
	la = len(a)
	lb = len(b)
	lc = len(c)
	a = [int(i) for i in a]
	b = [int(i) for i in b]
	c = [int(i) for i in c]
	pa = 0
	pb = 0
	pc = 0
	i = 0
	while True:
		if i > max(la, lb, lc) + 1:
			print('NO')
			break
		if i > la - 1:
			ca = 0
		else:
			ca = a[i]
		if i > lb - 1:
			cb = 0
		else:
			cb = b[i]
		if i > lc - 1:
			cc = 0
		else:
			cc = c[i]
		na = 0
		nb = 0
		nc = 0
		if pa == 1:
			if ca == 1:
				na = 1
				ca = 0
			else:
				ca = 1
				na = 0
		if pb == 1:
			if cb == 1:
				nb = 1
				cb = 0
			else:
				cb = 1
				nb = 0
		if pc == 1:
			if cc == 1:
				nc = 1
				cc = 0
			else:
				cc = 1
				nc = 0
		if ca == cb and cb != cc:
			if cc == 1:
				nc = 1
		elif cb == cc and cb != ca:
			if ca == 1:
				na = 1
		elif ca == cc and cb != ca:
			if cb == 1:
				nb = 1
		else:
			if update(a, b, c, i + 1, na, nb, nc, la, lb, lc):
				print('YES')
			else:
				print('NO')
			break
		pa = na
		pb = nb
		pc = nc
		i += 1


for h in range(int(input())):
	(x, y, z) = map(int, input().split())
	(i, k) = (0, 1)
	while i < 31:
		ze = []
		o = []
		if x & k == k:
			o.append(x)
		else:
			ze.append(x)
		if y & k == k:
			o.append(y)
		else:
			ze.append(y)
		if z & k == k:
			o.append(z)
		else:
			ze.append(z)
		if len(ze) == 3 or len(o) == 3:
			break
		elif len(ze) == 1:
			if x == ze[0]:
				x += k
			elif y == ze[0]:
				y += k
			else:
				z += k
		elif x == o[0]:
			x += k
		elif y == o[0]:
			y += k
		else:
			z += k
		k = k << 1
		i += 1
	if x == y and y == z:
		print('YES')
	else:
		print('NO')


t = int(input())

def solve():
	a = list(map(int, input().split()))
	k = 1
	if a[0] == a[1] and a[1] == a[2]:
		print('YES')
		return
	for _ in range(31):
		ones = 0
		if a[0] == a[1] and a[1] == a[2]:
			print('YES')
			return
		for i in range(3):
			ones += a[i] & k != 0
		if ones == 1:
			for i in range(3):
				if a[i] & k != 0:
					a[i] += k
		elif ones == 2:
			for i in range(3):
				if a[i] & k == 0:
					a[i] += k
		else:
			print('NO')
			return
		if a[0] == a[1] and a[1] == a[2]:
			print('YES')
			return
		k <<= 1
	print('NO')
for _ in range(t):
	solve()


for t in range(int(input())):
	n = list(map(int, input().strip().split()))
	p = 1
	is_possible = True
	while is_possible and (not n[0] == n[1] == n[2]):
		cnt = 0
		if n[0] & p:
			cnt += 1
			i = 0
		else:
			j = 0
		if n[1] & p:
			cnt += 1
			i = 1
		else:
			j = 1
		if n[2] & p:
			cnt += 1
			i = 2
		else:
			j = 2
		if cnt == 0 or cnt == 3:
			is_possible = False
		elif cnt == 2:
			n[j] += p
		else:
			t = p << 1
			if n[i] < t and n[(i + 1) % 3] < t and (n[(i + 2) % 3] < t):
				is_possible = False
			n[i] += p
		p <<= 1
	print('YES' if is_possible else 'NO')


T = int(input())
for case in range(T):
	(a, b, c) = map(int, input().split(' '))
	while True:
		(a, b, c) = sorted([a, b, c])
		if a % 2 == b % 2 == c % 2 or a + b + c == 1:
			break
		rem = (a + b + c) % 2
		if a % 2 == rem:
			a += 1
		elif b % 2 == rem:
			b += 1
		else:
			c += 1
		(a, b, c) = (0, b - a, c - a)
		(b, c) = (b // 2, c // 2)
	print('YES' if a == b == c else 'NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 0
	for i in range(0, 129):
		pw2 = 2 ** i - 1
		num = pw2 + a + b + c
		if num % 3 == 0:
			num = num // 3
			if num >= max({a, b, c}):
				(aa, bb, cc) = (num - a, num - b, num - c)
				if aa & bb == 0 and bb & cc == 0 and (aa & cc == 0):
					ans = 1
					break
	print(['YES', 'NO'][ans ^ 1])


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	x = min(min(a, b), c)
	a -= x
	b -= x
	c -= x
	temp = True
	while temp:
		if a == 0 and b == 0 and (c == 0):
			break
		if a == 0 and b == 0 or (b == 0 and c == 0) or (c == 0 and a == 0) or (a % 2 == b % 2 and a % 2 == c % 2):
			temp = False
			continue
		if a % 2 == b % 2:
			c += 1
		elif a % 2 == c % 2:
			b += 1
		else:
			a += 1
		a = a >> 1
		b = b >> 1
		c = c >> 1
	print('YES') if temp else print('NO')


def win(a, b, c):
	if a == b == c:
		return True
	elif (a, b, c) in [(0, 0, 1), (0, 1, 0), (1, 0, 0)]:
		return False
	elif a % 2 == b % 2 == c % 2:
		return False
	elif a % 2 == b % 2:
		return win(a // 2, b // 2, (c + 1) // 2)
	elif a % 2 == c % 2:
		return win(a // 2, (b + 1) // 2, c // 2)
	elif b % 2 == c % 2:
		return win((a + 1) // 2, b // 2, c // 2)
for _ in range(int(input())):
	(A, B, C) = map(int, input().split())
	print({0: 'NO', 1: 'YES'}[win(A, B, C)])


for _ in range(int(input())):
	last = None
	li = list(map(int, input().split()))
	while True:
		if li == last:
			print('NO')
			break
		last = li[:]
		if li[0] == li[1] == li[2]:
			print('YES')
			break
		c0 = 0
		c1 = 0
		for i in li:
			if i % 2 == 0:
				c0 += 1
			else:
				c1 += 1
		if c1 == 0 or c0 == 0:
			print('NO')
			break
		for i in range(len(li)):
			if c0 == 1:
				li[i] = li[i] >> 1
			elif li[i] % 2 == 1:
				li[i] = li[i] >> 1
				li[i] = li[i] + 1
			else:
				li[i] = li[i] >> 1


for _ in range(int(input())):
	l = list(map(int, input().split()))
	i = 0
	while (l[0] >> i, l[1] >> i, l[2] >> i).count(0) < 2:
		if len(set(l)) == 1:
			print('YES')
			break
		d = (l[0] >> i & 1, l[1] >> i & 1, l[2] >> i & 1)
		if d.count(1) == 1:
			l[d.index(1)] += 1 << i
		elif d.count(0) == 1:
			l[d.index(0)] += 1 << i
		else:
			print('NO')
			break
		if len(set(l)) == 1:
			print('YES')
			break
		i += 1
	else:
		print('NO')