Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.

This problem has no story, so we at least wish you good luck solving it.

Consider a multiset $S$ which contains $A$ copies of the integer $1$, $B$ copies of $2$ and $C$ copies of $3$. For example, if $A = 3$, $B = 3$ and $C = 3$, then $S = \{1, 1, 1, 2, 2, 2, 3, 3, 3\}$.

Your goal is to divide the elements of $S$ into two groups (multisets); each element of $S$ must be in exactly one of these groups and the sum of elements of one group must be equal to the sum of elements of the other group. In our example, it is possible to make the groups $\{1, 1, 2, 2, 3\}$ and $\{1, 2, 3, 3\}$; the sum of elements of each group is $9$.

Determine if it is possible to make such groups.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains three space-separated integers $A$, $B$ and $C$. 

------  Output ------
For each test case, print a single line containing the string "YES" if it is possible to create two groups with equal sums or "NO" if it is impossible.

------  Constraints ------
$1 ≤ T ≤ 1,000$
$0 ≤ A, B, C ≤ 1,000,000$
$A + B + C ≥ 1$

----- Sample Input 1 ------ 
5

3 3 3

3 2 3

1 1 2

1 0 1

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

YES

NO

NO

YES

Source: codechef | Difficulty: HARD
Tags: Constructive algorithms

Mathematics

Ad-hoc


Solutions:
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
	elif a % 2 != 0 and b % 2 != 0 and (c % 2 == 0) or (a % 2 == 0 and b % 2 != 0 and (c % 2 != 0)):
		print('NO')
	elif a % 2 != 0 and b % 2 == 0 and (c % 2 != 0):
		if b != 0 or a >= 3:
			print('YES')
		else:
			print('NO')
	elif a % 2 == 0 and b % 2 == 0 and (c % 2 != 0) or (a % 2 != 0 and b % 2 == 0 and (c % 2 == 0)):
		print('NO')
	elif a % 2 == 0 and b % 2 != 0 and (c % 2 == 0):
		if a >= 2 or (b > 1 and c >= 2):
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


T = int(input())
ans = []
for _ in range(T):
	(A, B, C) = [int(i) for i in input().split()]
	if A % 2 == 0 and B % 2 == 0 and (C % 2 == 0):
		a = 'YES'
	elif A % 2 == 0 and B % 2 == 0 and (C % 2 != 0):
		a = 'NO'
	elif A % 2 == 0 and B % 2 != 0 and (C % 2 == 0):
		if A >= 2 or (B >= 3 and C >= 2):
			a = 'YES'
		else:
			a = 'NO'
	elif A % 2 == 0 and B % 2 != 0 and (C % 2 != 0):
		a = 'NO'
	elif A % 2 != 0 and B % 2 == 0 and (C % 2 == 0):
		a = 'NO'
	elif A % 2 != 0 and B % 2 == 0 and (C % 2 != 0):
		if B >= 2 or A >= 3:
			a = 'YES'
		else:
			a = 'NO'
	elif A % 2 != 0 and B % 2 != 0 and (C % 2 == 0):
		a = 'NO'
	else:
		a = 'YES'
	ans.append(a)
for i in ans:
	print(i)


def solve(a, b, c):
	tot = a + 2 * b + 3 * c
	if tot % 2 != 0:
		return 'NO'
	if a == 0 and c == 0 and (b % 2 != 0):
		return 'NO'
	if a == 0 and b == 1 or (a == 1 and b == 0):
		return 'NO'
	return 'YES'
t = int(input())
for idx in range(t):
	s = input()
	a = s.split()
	print(solve(int(a[0]), int(a[1]), int(a[2])))


def abc(a, b, c):
	tot = a + 2 * b + 3 * c
	if tot % 2 == 1:
		return False
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return False
		return True
	if (a, b) == (0, 1):
		return False
	if (a, b) == (1, 0):
		return False
	return True
t = int(input())
for x in range(t):
	(a, b, c) = map(int, input().split())
	if abc(a, b, c) == True:
		print('YES')
	else:
		print('NO')


tc = int(input())
for ii in range(tc):
	(a, b, c) = map(int, input().split())
	n = a * 1 + b * 2 + c * 3
	if n % 2 == 1:
		print('NO')
		continue
	else:
		x = 0
		if a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
			x = 1
		if (a % 2 == 0 and b % 2 == 1 and (c % 2 == 0)) and (a >= 2 or (b >= 3 and c >= 2)):
			x = 1
		if (a % 2 == 1 and b % 2 == 0 and (c % 2 == 1)) and (a >= 3 or b >= 2):
			x = 1
		if a % 2 == 1 and b % 2 == 1 and (c % 2 == 1):
			x = 1
		if x == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
while t:
	t -= 1
	(a, b, c) = map(int, input().split())
	su = a + 2 * b + 3 * c
	if su & 1:
		print('NO')
	elif a == 1 and b == 0:
		print('NO')
	elif a == 0 and b == 1:
		print('NO')
	elif a == 0 and c == 0:
		if b & 1:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


def chk(a, b, c):
	tot = a + 2 * b + 3 * c
	if tot % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
for x in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(chk(a, b, c))


import sys
for _ in range(int(sys.stdin.readline())):
	(a, b, c) = map(int, sys.stdin.readline().split())
	flag = 0
	s = a * 1 + b * 2 + c * 3
	if s % 2 == 1:
		print('NO')
		flag = 1
	elif a == 0 and c == 0 and (b % 2 == 1):
		print('NO')
		flag = 1
	elif a + b == 1:
		print('NO')
		flag = 1
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	(A, B, C) = map(int, input().split())
	total = A * 1 + B * 2 + C * 3
	if total % 2 != 0:
		print('NO')
	elif A * B * C != 0:
		print('YES')
	elif A == 0 and C == 0:
		if B % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif A == 0 and B == 1:
		print('NO')
	elif A == 1 and B == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	sm = a + b * 2 + c * 3
	if sm & 1:
		print('NO')
		continue
	req = sm // 2
	three = req // 3
	three = min(three, c)
	f = 0

	def ok(tri):
		rem = req - tri * 3
		two = rem // 2
		if a >= rem - min(two, b) * 2:
			return 1
		return 0
	for i in range(three, max(three - 10, -1), -1):
		if ok(i):
			f = 1
	print('YES' if f else 'NO')


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans = 1 * a + 2 * b + 3 * c
	if ans % 2:
		print('NO')
	elif a != 0 and b != 0 and (c != 0):
		print('YES')
	elif a == 0 and c == 0:
		if b % 2:
			print('NO')
		else:
			print('YES')
	elif a == 0 and b == 1:
		print('NO')
	elif a == 1 and b == 0:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	while a >= 30:
		a -= 20
	while b >= 30:
		b -= 20
	while c >= 30:
		c -= 20
	if (a + 2 * b + 3 * c) % 2:
		print('NO')
		continue
	else:
		f = False
		for i in range(0, a + 1):
			for j in range(0, b + 1):
				for k in range(0, c + 1):
					if i + 2 * j + 3 * k == (a + 2 * b + 3 * c) // 2:
						f = True
		if f == True:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	sum_3 = a + 2 * b + 3 * c
	out = 'YES'
	if sum_3 % 2 == 0:
		if a == 0 and c == 0 and (b % 2 != 0):
			out = 'NO'
		if a == 1 and b == 0 or (a == 0 and b == 1):
			out = 'NO'
	else:
		out = 'NO'
	print(out)


def fun(a, b, c):
	k = a + 2 * b + 3 * c
	if k % 2 == 0:
		if a == 0 and c == 0:
			if b % 2 == 0:
				return 'YES'
			else:
				return 'NO'
		if a == 1 and b == 0:
			return 'NO'
		if a == 0 and b == 1:
			return 'NO'
		return 'YES'
	else:
		return 'NO'
for t in range(int(input())):
	(a, b, c) = map(int, input().split(' '))
	print(fun(a, b, c))


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	x = a + 2 * b + 3 * c
	if x % 2 != 0:
		print('NO')
		continue
	else:
		if a == 0 and c == 0:
			if b % 2 == 0:
				print('YES')
			else:
				print('NO')
			continue
		if c == 0:
			print('YES')
			continue
		if a == 0:
			if b == 1:
				print('NO')
			else:
				print('YES')
			continue
		x = x // 2
		d = x // 3
		k = min(c * 3, d * 3)
		d = (x - k) // 2
		k += min(d * 2, b * 2)
		d = x - k
		k += min(d, a)
		if k == x:
			print('YES')
		else:
			print('NO')


T = int(input())
for i in range(T):
	(o, tw, th) = list(map(int, input().split()))
	if o % 2 == 0 and tw % 2 == 0 and (th % 2 == 0):
		print('YES')
	elif (o * 1 + tw * 2 + th * 3) % 2 == 1:
		print('NO')
	elif o % 2 == 0 and tw % 2 == 1 and (th % 2 == 0):
		if o == 0 and th == 0 or (o == 0 and tw == 1):
			print('NO')
		else:
			print('YES')
	elif o % 2 == 1 and tw % 2 == 0 and (th % 2 == 1):
		if o == 1 and tw == 0:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


def solve(A, B, C):
	total = A + 2 * B + 3 * C
	if total & 1:
		return False
	if B & 1 and A == 0 and (C == 0):
		return False
	if B == 0 and A == 1:
		return False
	if A == 0 and B == 1:
		return False
	return True
t = int(input())
for _ in range(t):
	(A, B, C) = map(int, input().split())
	print('YES' if solve(A, B, C) else 'NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b * 2 + c * 3) % 2 != 0:
		print('NO')
		continue
	m = False
	while a >= 30:
		a -= 2
	while b >= 30:
		b -= 2
	while c >= 30:
		c -= 2
	for i in range(a + 1):
		if m:
			break
		for j in range(b + 1):
			if m:
				break
			for k in range(c + 1):
				if i + 2 * j + 3 * k == (a + 2 * b + 3 * c) // 2:
					m = True
					break
	if m == True:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a % 2 != 0 and b % 2 != 0 and (c % 2 != 0):
		print('YES')
	elif a % 2 != 0 and b % 2 != 0 and (c % 2 == 0):
		print('NO')
	elif a % 2 != 0 and b % 2 == 0 and (c % 2 == 0):
		print('NO')
	elif a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
	elif a % 2 != 0 and b % 2 == 0 and (c % 2 != 0):
		if b > 0 or a > 2:
			print('YES')
		else:
			print('NO')
	elif a % 2 == 0 and b % 2 != 0 and (c % 2 != 0):
		print('NO')
	elif a % 2 == 0 and b % 2 == 0 and (c % 2 != 0):
		print('NO')
	elif a % 2 == 0 and b % 2 != 0 and (c % 2 == 0):
		if a > 0 or (b > 2 and c > 0):
			print('YES')
		else:
			print('NO')


def abc(a, b, c):
	tot = a + 2 * b + 3 * c
	if tot % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
try:
	t = int(input())
	for x in range(t):
		(a, b, c) = map(int, input().split())
		print(abc(a, b, c))
except EOFError as e:
	pass


def fin(A, B, C):
	if A == 0 and B == 0 and (C % 2 == 0):
		return 'YES'
	elif A == 0 and B % 2 != 0 and (C == 0):
		return 'NO'
	elif A % 2 == 0 and B == 0 and (C == 0):
		return 'YES'
	elif A == 0 and B == 1:
		return 'NO'
	elif B == 0 and A == 1:
		return 'NO'
	elif (A + 2 * B + 3 * C) % 2 != 0:
		return 'NO'
	else:
		return 'YES'
for _ in range(int(input())):
	(A, B, C) = map(int, input().split())
	print(fin(A, B, C))


def func(a, b, c):
	if a == 0 and b == 0 and (c % 2 == 0):
		return 'YES'
	elif a == 0 and b % 2 != 0 and (c == 0):
		return 'NO'
	elif a % 2 == 0 and b == 0 and (c == 0):
		return 'YES'
	elif a == 0 and b == 1:
		return 'NO'
	elif b == 0 and a == 1:
		return 'NO'
	elif (a + 2 * b + 3 * c) % 2 != 0:
		return 'NO'
	else:
		return 'YES'
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(func(a, b, c))


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	if (a + 2 * b + 3 * c) % 2:
		print('NO')
		continue
	if c == 0 and a == 0:
		if b % 2:
			print('NO')
		else:
			print('YES')
		continue
	if a == 1 and b == 0:
		if c % 2:
			print('NO')
			continue
	if b == 1 and a == 0:
		if not c % 2:
			print('NO')
			continue
	print('YES')


t = int(input())
while t > 0:
	t -= 1
	(a, b, c) = map(int, input().split())
	if a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
		continue
	s = a + 2 * b + 3 * c
	if s % 2 == 1:
		print('NO')
	else:
		s = s // 2
		while s - 3 >= 0 and c > 0:
			s -= 3
			c -= 1
		while s - 2 >= 0 and b > 0:
			s -= 2
			b -= 1
		while s - 1 >= 0 and a > 0:
			s -= 1
			a -= 1
		if s != 0:
			print('NO')
		else:
			print('YES')


T = int(input())
for i in range(T):
	(a, b, c) = list(map(int, input().split()))
	sum = a + 2 * b + 3 * c
	if sum % 2 != 0:
		print('NO')
	elif a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
	elif a == 0 and b == 0 and (c != 0) or (a == 0 and b != 0 and (c == 0)) or (a != 0 and b == 0 and (c == 0)):
		if b % 2 != 0:
			print('NO')
		else:
			print('YES')
	elif a != 0 and b != 0 and (c == 0):
		print('YES')
	elif a == 0 and b != 0 and (c != 0):
		if b % 2 == 0:
			print('YES')
		elif b < 2:
			print('NO')
		else:
			print('YES')
	elif a != 0 and b == 0 and (c != 0):
		if a < 2:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


def check(a, b, c):
	s = a + 2 * b + 3 * c
	if s % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(check(a, b, c))


def ans(a, b, c):
	if (a + b * 2 + c * 3) % 2 != 0:
		return 'NO'
	if a == 0 and c == 0:
		if b % 2:
			return 'NO'
	if a == 1 and b == 0:
		return 'NO'
	if a == 0 and b == 1:
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(ans(a, b, c))


try:
	T = int(input())
	while T > 0:
		(A, B, C) = map(int, input().split())
		s = A + B * 2 + C * 3
		if s % 2 != 0:
			print('NO')
		elif A == 0 and B == 1 or (A == 1 and B == 0) or (A == 0 and C == 1) or (A == 1 and C == 0) or (A == 0 and B % 2 != 0 and (C == 0)) or (A == 0 and B == 0 and (C % 2 != 0)) or (A % 2 != 0 and B == 0 and (C == 0)):
			print('NO')
		else:
			print('YES')
		T -= 1
except Exception as e:
	pass


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
		continue
	s = 1 * a + 2 * b + 3 * c
	if s % 2 != 0:
		print('NO')
	else:
		k = s / 2
		while c > 0 and k > 2:
			k -= 3
			c -= 1
		while b > 0 and k > 1:
			k -= 2
			b -= 1
		while a > 0 and k > 0:
			k -= 1
			a -= 1
		if k == 0:
			print('YES')
		else:
			print('NO')


def logic(a, b, c):
	tot = a + 2 * b + 3 * c
	if tot % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
t = int(input())
for x in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	print(logic(a, b, c))


def sol(a, b, c):
	t = a + 2 * b + 3 * c
	if t % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(sol(a, b, c))


def main():
	t = int(input())
	for _ in range(t):
		(a, b, c) = map(int, input().split())
		sum = a + b * 2 + c * 3
		if sum % 2 == 1:
			print('NO')
			continue
		if (b == 1 and c % 2 == 0 or (b % 2 == 1 and c == 0)) and a == 0:
			print('NO')
			continue
		if b == 0 and (a == 1 and c % 2 == 1):
			print('NO')
			continue
		print('YES')
main()


t = int(input())
for i in range(t):
	a = input()
	a = a.split()
	s = int(a[0]) * 1 + int(a[1]) * 2 + int(a[2]) * 3
	if s % 2 != 0:
		print('NO')
	elif int(a[0]) == 1 and int(a[1]) == 0:
		print('NO')
	elif int(a[0]) == 0 and int(a[1]) == 1:
		print('NO')
	elif int(a[0]) == 0 and int(a[2]) == 0 and (int(a[1]) % 2 != 0):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b, c) = [int(z) for z in input().split()]
	total = a + b * 2 + c * 3
	if total % 2 != 0:
		print('NO')
		continue
	else:
		if b == 0 and (a == 1 and c % 2 == 1):
			print('NO')
			continue
		if a == 0 and (b == 1 and c % 2 == 0 or (b % 2 == 1 and c == 0)):
			print('NO')
			continue
		print('YES')


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	sum1 = a + b * 2 + c * 3
	if sum1 % 2 != 0:
		print('NO')
	elif a > 0 and b > 0 and (c > 0):
		print('YES')
	elif a == 0 and c == 0 and (b > 0):
		if sum1 % 4 == 0:
			print('YES')
		else:
			print('NO')
	elif a == 0 and b == 1 and (c % 2 == 0):
		print('NO')
	elif b == 0 and a == 1 and (c % 2 != 0):
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	if (a + 2 * b + 3 * c) % 2 != 0:
		print('NO')
		continue
	if a % 2 == 0 and b % 2 == 0 and (c % 2 == 0):
		print('YES')
		continue
	ans = (a + 2 * b + 3 * c) // 2
	ans = ans - 3 * min(ans // 3, c)
	ans = ans - 2 * min(ans // 2, b)
	ans = ans - 1 * min(ans // 1, a)
	if ans != 0:
		print('NO')
	else:
		print('YES')


while True:
	try:
		for _ in range(int(input())):
			(a, b, c) = map(int, input().split())
			TotalSum = a + 2 * b + 3 * c
			if TotalSum % 2 == 1:
				print('NO')
			else:
				Possible = False
				HalfSum = TotalSum // 2
				icurr = 0
				for i in range(min(c, HalfSum // 3), -1, -1):
					RemainingSum = HalfSum - 3 * i
					curr = 0
					for j in range(min(b, RemainingSum // 2), -1, -1):
						if RemainingSum - 2 * j <= a:
							Possible = True
						curr += 1
						if curr == 3:
							break
					icurr += 1
					if icurr == 3:
						break
				print('YES' if Possible else 'NO')
	except:
		break


t = int(input())
sum = 0
for i in range(t):
	(aa, bb, cc) = map(int, input().split())
	sum = 1 * aa + 2 * bb + 3 * cc
	if sum % 2 != 0:
		print('NO')
	elif aa == 1 and bb == 0 and (cc % 2 != 0):
		print('NO')
	elif aa == 0 and bb % 2 != 0 and (cc == 0):
		print('NO')
	elif aa == 0 and bb == 1 and (cc % 2 == 0):
		print('NO')
	else:
		print('YES')


def m():
	t = int(input())
	while t > 0:
		(a, b, c) = map(int, input().split())
		s1 = a * 1 + b * 2 + c * 3
		k = s1 // 2
		k2 = s1 / 2
		if k != k2:
			print('NO')
		elif a == 0 and c == 0:
			if b % 2 == 1:
				print('NO')
			else:
				print('YES')
		elif a == 0 and b == 1:
			print('NO')
		elif a == 1 and b == 0:
			print('NO')
		else:
			print('YES')
		t -= 1
m()


try:
	t = int(input())
	for i in range(t):
		(a, b, c) = list(map(int, input().split()))
		if (a + 2 * b + 3 * c) % 2 != 0:
			print('NO')
		elif a == 0 and b == 0 and (c % 2 == 0):
			print('YES')
		elif a % 2 == 0 and b == 0 and (c == 0):
			print('YES')
		elif a == 0 and b % 2 != 0 and (c == 0):
			print('NO')
		elif a == 0 and b == 1:
			print('NO')
		elif b == 0 and a == 1:
			print('NO')
		else:
			print('YES')
except:
	pass


def abc(tot, a, b, c):
	if tot % 2 == 1:
		return 'NO'
	if (a, c) == (0, 0):
		if b % 2 == 1:
			return 'NO'
		return 'YES'
	if (a, b) == (0, 1):
		return 'NO'
	if (a, b) == (1, 0):
		return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	tot = a + 2 * b + 3 * c
	print(abc(tot, a, b, c))
	t -= 1


t = int(input())
while t:
	t -= 1
	(a, b, c) = map(int, input().strip().split())
	possible = False
	while a >= 10:
		a -= 2
	while b >= 10:
		b -= 2
	while c >= 10:
		c -= 2
	SUM = a + 2 * b + 3 * c
	if not SUM % 2 == 0:
		print('NO')
	else:
		for i in range(a + 1):
			for j in range(b + 1):
				for k in range(c + 1):
					if i + 2 * j + 3 * k == SUM / 2:
						possible = True
		if possible:
			print('YES')
		else:
			print('NO')


t = int(input())
for u in range(t):
	(a, b, c) = input().split(' ')
	(a, b, c) = (int(a), int(b), int(c))
	s = a * 1 + b * 2 + c * 3
	if s % 2 != 0:
		print('NO')
	else:
		s = s / 2
		if a > 0 and b > 0 and (c > 0):
			print('YES')
		elif a == 0 and b == 0:
			if c % 2 == 0:
				print('YES')
			else:
				print('NO')
		elif a == 0 and c == 0:
			if b % 2 == 0:
				print('YES')
			else:
				print('NO')
		elif c == 0 and b == 0:
			if a % 2 == 0:
				print('YES')
			else:
				print('NO')
		elif a == 0:
			max = 2 * b + 3 * c
			if b == 1:
				z = s - 1
				if z % 3 == 0:
					print('NO')
				else:
					print('YES')
			elif s == max - 1 or s == 1:
				print('NO')
			else:
				print('YES')
		elif b == 0:
			if a == 1:
				z = s - 2
				if z % 3 == 0:
					print('NO')
				else:
					print('YES')
			else:
				print('YES')
		elif c == 0:
			print('YES')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	k = a + 2 * b + 3 * c
	l = ['10', '01']
	if k % 2 or (a == 0 and c == 0 and b % 2) or str(a) + str(b) in l:
		print('NO')
	else:
		print('YES')