You are given a positive integer N. You have to split each digit of N into either of two non-empty subsequences A or B.  

For example, if N = 104, some possible values of (A, B) can be (10, 4), (14, 0) and (1, 4). Note that, after separating the digits into A and B, these subsequences are considered as positive integers and thus leading zeros can be omitted.

Let us define a function F(X,Y) = (X+Y) \%2. Find out whether it is possible to find two non-empty subsequences A and B formed out of N such that F(A,B) = 0.

------ 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, one integer N.

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

For each test case, print \texttt{YES} if it is possible to find two non-empty subsequences A and B formed out of N such that F(A,B) = 0. Otherwise, print \texttt{NO}.

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

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

$1 ≤ T ≤ 1000$
$10 ≤ N ≤ 10^{9}$

------ subtasks ------ 

Subtask 1 (100 points): Original constraints.

----- Sample Input 1 ------ 
2
10
73452
----- Sample Output 1 ------ 
NO
YES

----- explanation 1 ------ 
Test Case $1$: The only two possibilities are:
- $A = 0, B = 1$: Here $F(A,B) = (A + B) \% 2 = (0 + 1) \% 2 = 1 \% 2 = 1$. 
- $A = 1, B = 0$: Here $F(A,B) = (A + B) \% 2 = (1 + 0) \% 2 = 1 \% 2 = 1$. 
Hence it's not possible to achieve $F(A, B) = 0$.

Test Case $2$: One of the possible ways to split the digits of $N$ such that $F(A,B) = 0$ is:
- $A = 74, B = 352$: Here $F(A,B) = (A + B) \% 2 = (74 +352) \% 2 = 426 \% 2 = 0$.

Difficulty: EASY
Tags: Complete search
Skill types: Complete search

Starter code:

Solutions:
for t in range(int(input())):
	n = int(input())
	m = n
	(e, o) = (0, 0)
	while n > 0:
		a = n % 10
		if a % 2 == 0:
			e += 1
		else:
			o += 1
		n = n // 10
	if m % 2 == 0 and e > 1 or (m % 2 != 0 and o > 1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = input()
	a = int(s[-1])
	ans = 'NO'
	for i in range(len(s) - 1):
		if (int(s[i]) + a) % 2 == 0:
			ans = 'YES'
			break
	print(ans)


T = int(input())
for _ in range(0, T):
	n = str(input())
	for i in range(0, len(n) - 1):
		a = n[:i + 1]
		b = n[i + 1:]
		a = int(a)
		b = int(b)
		if (a + b) % 2 == 0:
			print('YES')
			break
	else:
		print('NO')


for _ in range(int(input())):
	s = input()
	length = len(s)
	if int(s[-1]) % 2 == 0:
		for i in range(length - 1):
			if int(s[i]) % 2 == 0:
				print('YES')
				break
		else:
			print('NO')
	else:
		for i in range(length - 1):
			if int(s[i]) % 2 == 1:
				print('YES')
				break
		else:
			print('NO')


for _ in range(int(input())):
	n = input()
	l = [int(i) for i in n if int(i) % 2 == 0]
	m = [int(i) for i in n if int(i) % 2 != 0]
	if len(l) >= 2 and int(n[-1]) % 2 == 0 or (len(m) >= 2 and int(n[-1]) % 2 != 0):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	c1 = 0
	c2 = 0
	for ele in str(n):
		if int(ele) % 2 == 0:
			c1 += 1
		else:
			c2 += 1
	if n % 2 == 0 and c1 > 1 or (n % 2 != 0 and c2 > 1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	n = str(n)
	even_count = 0
	odd_count = 0
	reverse_n = n[-1::-1]
	first_digit = int(reverse_n[0])
	if first_digit % 2 == 0:
		for i in reverse_n:
			if int(i) % 2 == 0:
				even_count += 1
		if even_count >= 2:
			print('YES')
		else:
			print('NO')
	else:
		for i in reverse_n:
			if int(i) % 2 != 0:
				odd_count += 1
		if odd_count >= 2:
			print('YES')
		else:
			print('No')


for t in range(int(input())):
	n = input()
	(even, odd) = (0, 0)
	for i in range(len(n)):
		a = int(n[i])
		if a % 2 == 0:
			even += 1
		else:
			odd += 1
	if even >= 2 and int(n[-1]) % 2 == 0:
		print('YES')
	elif odd >= 2 and int(n[-1]) % 2 != 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for j in range(n):
	key = 0
	num = input()
	for i in range(len(num) - 1):
		a = int(num[0:i + 1])
		b = num[i + 1:len(num)]
		b = b.lstrip('0')
		if b == '':
			b = 0
		c = int(b)
		if (a + c) % 2 == 0:
			key = 1
			break
	if key:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = input()
	isEven = False
	if int(n[-1]) % 2 == 0:
		isEven = True
	flag = False
	for i in range(len(n) - 1):
		if isEven and int(n[i]) % 2 == 0:
			print('YES')
			flag = True
			break
		elif not isEven and int(n[i]) % 2 != 0:
			print('YES')
			flag = True
			break
	if not flag:
		print('NO')


tests = int(input())
for i in range(tests):
	num = input()
	length = len(num)
	last_num = int(num[-1])
	ans = 'NO'
	for k in range(length - 1):
		temp = int(num[k])
		if temp == 0 and k != 0 and (last_num % 2 == 0):
			ans = 'YES'
			break
		if temp != 0 and last_num % 2 == temp % 2:
			ans = 'YES'
			break
	print(ans)


for _ in range(int(input())):
	s = str(input())
	e = 0
	y = True
	if int(s[-1]) % 2 == 0:
		e = 1
	for i in s[:-1]:
		if e == 1 and int(i) % 2 == 0:
			y = False
			print('YES')
			break
		elif e == 0 and int(i) % 2 != 0:
			y = False
			print('YES')
			break
	if y:
		print('NO')


for _ in range(int(input())):
	n = input()
	ans = 'NO'
	last = int(n[len(n) - 1])
	if last % 2 == 0:
		for i in range(len(n) - 1):
			if int(n[i]) % 2 == 0:
				ans = 'YES'
				break
	else:
		for i in range(len(n) - 1):
			if int(n[i]) % 2 == 1:
				ans = 'YES'
				break
	print(ans)


for _ in range(int(input())):
	n = input()
	(odd, even) = (0, 0)
	for i in n:
		if int(i) % 2 == 1:
			odd += 1
		else:
			even += 1
	if even == 1 and (int(n[-1]) % 2 == 0 or odd < 2) or (odd == 1 and int(n[-1]) % 2 == 1):
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	n = input()
	(e, o) = (0, 0)
	for i in range(1, len(n)):
		if (int(n[:i]) + int(n[i:])) % 2 == 0:
			print('YES')
			break
	else:
		print('NO')


tc = int(input())
for _ in range(tc):
	n = int(input())
	odd = 0
	even = 0
	ctr = 0
	for m in str(n):
		if str(n).index(m) == len(str(n)) - 1:
			break
		if even == 2 or odd == 2:
			ctr += 1
		if int(m) % 2 == 0:
			even += 1
		else:
			odd += 1
	if n % 2 == 0 and even >= 1:
		print('YES')
	elif n % 2 != 0 and odd >= 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	count = 0
	odd = 0
	s = str(n)
	for i in range(len(s) - 1):
		if int(s[i]) % 2 == 0:
			count += 1
		elif int(s[i]) % 2 != 0:
			odd += 1
	if n % 2 == 0 and count >= 1:
		print('YES')
	elif n % 2 != 0 and odd >= 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = input()
	f = 0
	if int(s[-1]) % 2 == 0:
		for i in range(len(s) - 1):
			if int(s[i]) in [0, 2, 4, 6, 8]:
				f = 1
				break
	else:
		for i in range(len(s) - 1):
			if int(s[i]) in [1, 3, 5, 7, 9]:
				f = 1
				break
	if f == 0:
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(0, T):
	a = input()
	a = list(a)
	b = len(a)
	for j in range(0, b):
		a[j] = int(a[j])
	if a[-1] % 2 == 0:
		for j in range(0, b - 1):
			if a[j] % 2 == 0:
				print('YES')
				break
		else:
			print('NO')
	else:
		for j in range(0, b - 1):
			if a[j] % 2 == 1:
				print('YES')
				break
		else:
			print('NO')


for _ in range(int(input())):
	s = input()
	lst = int(s[-1])
	s = s[:-1]
	f = 0
	for i in s:
		val = int(i)
		if val % 2 == 0 and lst % 2 == 0:
			print('YES')
			f = 1
			break
		elif val % 2 != 0 and lst % 2 != 0:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


for _ in range(int(input())):
	l = list(input())
	f = 0
	d = int(l.pop())
	for i in l:
		i = int(i)
		if i % 2 == 0 and d % 2 == 0:
			print('YES')
			f = 1
			break
		elif i % 2 != 0 and d % 2 != 0:
			print('YES')
			f = 1
			break
	if f == 0:
		print('NO')


for _ in range(int(input())):
	l = list(map(int, list(input())))
	flag = 0
	e = 0
	o = 0
	d = l[-1]
	for i in range(len(l) - 1):
		if l[i] % 2 == 0 and d % 2 == 0:
			print('YES')
			flag = 1
			break
		if l[i] % 2 != 0 and d % 2 != 0:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = n % 10 % 2
	n = n // 10
	flag = 0
	while n:
		if n % 10 % 2 == l:
			print('YES')
			flag = 1
			break
		n = n // 10
	if flag == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = input()
	s1 = int(n)
	even = ['2', '4', '6', '8', '0']
	odd = ['1', '3', '5', '7', '9']
	if s1 % 10 % 2 == 0:
		n = n[0:len(n) - 1]
		c = 0
		for i in range(len(n)):
			if n[i] in even:
				c += 1
			else:
				continue
		if c == 0:
			print('NO')
		else:
			print('YES')
	if s1 % 10 % 2 == 1:
		n = n[0:len(n) - 1]
		c = 0
		for i in range(len(n)):
			if n[i] in odd:
				c += 1
			else:
				continue
		if c == 0:
			print('NO')
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = list(input())
	ln = len(n)
	flag = 0
	if int(n[ln - 1]) % 2 == 0:
		for i in range(0, ln - 1):
			if int(n[i]) % 2 == 0:
				print('YES')
				flag = 1
				break
	else:
		for i in range(0, ln - 1):
			if int(n[i]) % 2 != 0:
				print('YES')
				flag = 1
				break
	if flag == 0:
		print('NO')


for _ in range(int(input())):
	n = input()
	l = len(n)
	flag = 0
	if int(n[l - 1]) % 2 == 0:
		for i in range(0, l - 1):
			if int(n[i]) % 2 == 0:
				print('YES')
				flag = 1
				break
	else:
		for i in range(0, l - 1):
			if int(n[i]) % 2 != 0:
				print('YES')
				flag = 1
				break
	if flag == 0:
		print('NO')


t = int(input())
for _ in range(t):
	n = input()
	o = 0
	e = 0
	for i in n:
		if int(i) % 2 == 0:
			e += 1
		else:
			o += 1
	if o >= 2 and int(n[-1]) % 2 != 0 or (e >= 2 and int(n[-1]) % 2 == 0):
		print('YES')
	else:
		print('NO')


ans = []
for i in range(int(input())):
	x = []
	a = input()
	for i in range(len(a)):
		x.append(int(a[i]))
	if x[-1] % 2 == 0:
		x.pop(-1)
		res = False
		for i in x:
			if i % 2 == 0:
				res = True
				break
		if res == True:
			ans.append('YES')
		else:
			ans.append('NO')
	else:
		x.pop(-1)
		res = False
		for i in x:
			if i % 2 != 0:
				res = True
				break
		if res == True:
			ans.append('YES')
		else:
			ans.append('NO')
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	n = input()
	no = 0
	ne = 0
	for i in n:
		if int(i) % 2 == 0:
			ne += 1
		else:
			no += 1
	if no >= 2 and int(n[-1]) % 2 != 0 or (ne >= 2 and int(n[-1]) % 2 == 0):
		print('YES')
	else:
		print('NO')


from typing import Counter

def getlist():
	return list(map(int, input().split(' ')))

def solve(t):
	n = str(input())
	ecount = 0
	ocount = 0
	for i in n:
		if int(i) % 2 == 0:
			ecount += 1
		else:
			ocount += 1
	if ecount >= 2 and int(n[len(n) - 1]) % 2 == 0 or (ocount >= 2 and int(n[len(n) - 1]) % 2 != 0):
		print('YES')
	else:
		print('NO')
try:
	for i in range(int(input())):
		solve(i)
except:
	pass


t = int(input())
for i in range(t):
	n = input()
	flag = ''
	if int(n[-1]) % 2 == 0:
		flag = 'even'
	else:
		flag = 'odd'
	for i in n[:-1]:
		if int(i) % 2 == 0:
			if flag == 'even':
				print('YES')
				flag = 'done'
				break
		elif flag == 'odd':
			print('YES')
			flag = 'done'
			break
	if flag != 'done':
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	n = str(n)
	l = len(n)
	flag = 0
	n1 = int(n[l - 1])
	if n1 % 2 == 0:
		for i in range(l - 2, -1, -1):
			if int(n[i]) % 2 == 0:
				print('YES')
				flag = 1
				break
	else:
		for i in range(l - 2, -1, -1):
			if int(n[i]) % 2 != 0:
				print('YES')
				flag = 1
				break
	if flag == 0:
		print('NO')
	t -= 1


t = int(input())
for tc in range(t):
	arr = input()
	pair = int(arr[-1])
	flag = 0
	if pair % 2 == 0:
		flag = 1
	if flag:
		for i in range(len(arr) - 1):
			if int(arr[i]) % 2 == 0:
				print('YES')
				break
		else:
			print('NO')
	else:
		for i in range(len(arr) - 1):
			if int(arr[i]) % 2 != 0:
				print('YES')
				break
		else:
			print('NO')


a = ''
b = ''
for i in range(int(input())):
	n = input()
	for j in range(len(n) - 1):
		for k in range(j + 1):
			a = a + n[k]
		for l in range(j + 1, len(n)):
			b = b + n[l]
		if (int(b) + int(a)) % 2 == 0:
			print('YES')
			break
	else:
		print('NO')


T = int(input())
for _ in range(T):
	N = input()
	o = [i for i in N if int(i) % 2 != 0]
	e = [i for i in N if int(i) % 2 == 0]
	p = int(N[-1]) % 2
	if p == 0 and len(e) > 1:
		print('YES')
	elif p == 1 and len(o) > 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	t = t - 1
	a = input()
	for i in range(len(a) - 1):
		b = ''
		c = ''
		for k in range(i + 1):
			c += a[k]
		for j in range(i + 1, len(a)):
			b += a[j]
		if (int(b) + int(c)) % 2 == 0:
			print('YES')
			break
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	(p, ans, r, n) = (0, 'NO', 0, num)
	while n > 0:
		r += n % 10 * 10 ** p
		n //= 10
		if r == num:
			break
		if (r + n) % 2 == 0:
			ans = 'YES'
			break
		p += 1
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	z = 0 if s[-1] in '02468' else 1
	fg = 0
	for i in range(len(s) - 1):
		if s[i] in '02468' and z == 0:
			fg = 1
			break
		elif s[i] in '13579' and z == 1:
			fg = 1
			break
	if fg == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(0, t):
	s = input()
	s_last = int(s[len(s) - 1])
	parity = s_last % 2
	flag = 0
	for i in range(0, len(s) - 1):
		if int(s[i]) % 2 == parity:
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	l = n % 10 % 2
	n = n // 10
	c = 0
	while n:
		if n % 10 % 2 == l:
			c = 1
			break
		n = n // 10
	if c == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for tc in range(t):
	n = input()
	if int(n) >= 10:
		dig = [int(i) for i in list(n)]
		(j, k) = (0, 0)
		for d in dig[:-1]:
			if d % 2 == 0:
				j += 1
			else:
				k += 1
			if j == 1 and int(n) % 2 == 0 or (k == 1 and int(n) % 2 != 0):
				ans = 'YES'
				break
		else:
			ans = 'NO'
		print(ans)
	else:
		break


def possible(s):
	x = int(s[len(s) - 1]) % 2
	if x == 0:
		i = 0
		while i < len(s) - 1:
			if int(s[i]) % 2 == 0:
				return 'YES'
			i += 1
		return 'NO'
	else:
		i = 0
		while i < len(s) - 1:
			if int(s[i]) % 2 != 0:
				return 'YES'
			i += 1
		return 'NO'
test_cases = int(input())
while test_cases != 0:
	data = input()
	print(possible(data))
	test_cases -= 1


def possible(integer):
	even = 0
	odd = 0
	for i in integer:
		if int(i) % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd >= 2 and int(integer[-1]) % 2 != 0:
		print('YES')
	elif even >= 2 and int(integer[-1]) % 2 == 0:
		print('YES')
	else:
		print('NO')
tests = int(input())
for test in range(tests):
	integer = input()
	possible(integer)


def sad(n):
	itr = len(str(n))
	base = 10
	for i in range(itr):
		a = n // base
		b = n % base
		if int(a) != 0 and int(a + b) % 2 == 0:
			return 'YES'
		base *= 10
	return 'NO'

def main():
	for _ in range(int(input())):
		n = int(input())
		print(sad(n))
main()


for _ in range(int(input())):
	no = input().strip()
	pos = False
	for i in range(1, len(no)):
		(first, second) = (int(no[:i]), int(no[i:]))
		if (first + second) % 2 == 0:
			pos = True
			break
	print('YES' if pos else 'NO')


import sys
t = int(input())
while t:
	s = input()
	o = 0
	e = 0
	if int(s[-1]) % 2 == 0:
		for i in s:
			if int(i) % 2 == 0:
				e += 1
			if e == 2:
				break
		if e == 2:
			print('YES')
		else:
			print('NO')
	else:
		for i in s:
			if int(i) % 2 != 0:
				o += 1
			if o == 2:
				break
		if o == 2:
			print('YES')
		else:
			print('NO')
	t -= 1


import sys
t = int(input())
for i in range(t):
	x = input()
	d = dict()
	for j in x[:-1]:
		if int(j) in d:
			d[int(j)] += 1
		else:
			d[int(j)] = 1
	if int(x[-1]) % 2 == 0:
		su = 0
		for j in [2, 4, 6, 8, 0]:
			if j in d:
				su += d[j]
		if su >= 1:
			print('YES')
			continue
		else:
			print('NO')
	else:
		su = 0
		for j in [1, 3, 5, 7, 9]:
			if j in d:
				su += d[j]
		if su >= 1:
			print('YES')
			continue
		else:
			print('NO')


for _ in range(int(input())):
	s = input()
	f = False
	for i in range(len(s) - 1):
		if int(s[-1]) % 2 == int(s[i]) % 2:
			f = True
			break
	if f == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = input()
	for i in range(len(a) - 1):
		if int(a[i]) % 2 == int(a[-1]) % 2:
			print('YES')
			break
	else:
		print('NO')


T = int(input())
for x in range(T):
	N = int(input())
	global B
	B = 0
	global count
	count = 0
	n = N
	while n > 0:
		count = count + 1
		n = n // 10
	for x in range(1, count):
		N1 = int(N / 10 ** x)
		N2 = int(N % 10 ** x)
		A = (N1 + N2) % 2
		if A == 0:
			print('YES')
			B = 1
			break
		else:
			continue
	if B == 0:
		print('NO')


for i in range(int(input())):
	number = input()
	oddNo = 0
	evenNo = 0
	for digit in number:
		if int(digit) % 2 == 0:
			evenNo += 1
		else:
			oddNo += 1
	if oddNo >= 2 and int(number[-1]) % 2 != 0 or (evenNo >= 2 and int(number[-1]) % 2 == 0):
		print('YES')
	else:
		print('NO')


import math
T = int(input())
for i in range(T):
	N = int(input())
	digits = int(math.log10(N)) + 1
	val = []
	for i in range(digits):
		n = N % 10
		val.append(n)
		N = int(N / 10)
	val.reverse()
	ans = 'NO'
	for i in range(digits - 1):
		if val[i] % 2 == 0 and val[digits - 1] % 2 == 0:
			ans = 'YES'
			break
		elif val[i] % 2 != 0 and val[digits - 1] % 2 != 0:
			ans = 'YES'
			break
	print(ans)


T = int(input())
for _ in range(T):
	N = int(input())
	arr = []
	flag = False
	for digit in str(N):
		arr.append(int(digit))
	if N % 2 == 0:
		for i in range(len(arr) - 1):
			if arr[i] % 2 == 0:
				flag = True
				break
			else:
				pass
	elif N % 2 == 1:
		for i in range(len(arr) - 1):
			if arr[i] % 2 == 1:
				flag = True
				break
			else:
				pass
	else:
		pass
	if flag == True:
		print('YES')
	else:
		print('NO')