Alice and Bob received $n$ candies from their parents. Each candy weighs either 1 gram or 2 grams. Now they want to divide all candies among themselves fairly so that the total weight of Alice's candies is equal to the total weight of Bob's candies.

Check if they can do that.

Note that candies are not allowed to be cut in half.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The first line of each test case contains an integer $n$ ($1 \le n \le 100$) — the number of candies that Alice and Bob received.

The next line contains $n$ integers $a_1, a_2, \ldots, a_n$ — the weights of the candies. The weight of each candy is either $1$ or $2$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.


-----Output-----

For each test case, output on a separate line:

"YES", if all candies can be divided into two sets with the same weight;

"NO" otherwise.

You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).


-----Examples-----

Input
5
2
1 1
2
1 2
4
1 2 1 2
3
2 2 2
3
2 1 2
Output
YES
NO
YES
NO
NO


-----Note-----

In the first test case, Alice and Bob can each take one candy, then both will have a total weight of $1$.

In the second test case, any division will be unfair.

In the third test case, both Alice and Bob can take two candies, one of weight $1$ and one of weight $2$.

In the fourth test case, it is impossible to divide three identical candies between two people.

In the fifth test case, any division will also be unfair.

Source: codeforces | Difficulty: EASY
Tags: Dynamic programming

Mathematics

Greedy algorithms


Solutions:
for s in [*open(0)][2::2]:
	a = s.count('1')
	print('YNEOS'[a % 2 or a < len(s) % 4::2])


for s in [*open(0)][2::2]:
	a = s.count('1')
	s = s.strip().split()
	print('YNEOS'[a % 2 or a < len(s) % 2::2])


for s in [*open(0)][2::2]:
	f = s.count
	a = f('1')
	print('YNEOS'[a % 2 or a < f('2') % 2 * 2::2])


ans = []
for _ in range(int(input())):
	n = int(input())
	candy = [*map(int, input().split())]
	n1 = candy.count(1)
	n2 = candy.count(2)
	if n1 != 0 and n1 % 2 == 0:
		ans += ['YES']
	elif n1 == n2 % 2 == 0:
		ans += ['YES']
	else:
		ans += ['NO']
print('\n'.join(ans))


t = int(input())
output = []
for _ in range(t):
	n = int(input())
	candies = [int(_) for _ in input().split()]
	if sum(candies) % 2 == 0 and (n % 2 == 0 or 1 in candies):
		output.append('YES')
		continue
	output.append('NO')
print('\n'.join(map(str, output)))


from collections import defaultdict, deque
import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	one = a.count(1)
	if one >= 2 and one % 2 == 0:
		print('YES')
	elif one == 0:
		print('YES' if n % 2 == 0 else 'NO')
	else:
		print('NO')


t = int(input())
ANS = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) % 2 == 1:
		ANS.append('NO')
	else:
		otv = sum(a) // 2
		dv = a.count(2)
		if otv % 2 == 0:
			if otv - 2 * dv <= a.count(1):
				ANS.append('YES')
			else:
				ANS.append(0)
		elif a.count(1) == 0:
			ANS.append('NO')
		elif otv - 2 * dv <= a.count(1):
			ANS.append('YES')
		else:
			ANS.append('NO')
for i in ANS:
	print(i)


def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	sym = sum(a)
	if sym % 2 != 0:
		return 'NO'
	if set(a) == set([2]):
		return 'YES' if len(a) % 2 == 0 else 'NO'
	return 'YES' if a.count(1) % 2 == 0 else 'NO'
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


import sys
input = sys.stdin.readline

def print(*args, end='\n', sep=' ') -> None:
	sys.stdout.write(sep.join(map(str, args)) + end)

def Solve():
	input()
	l = input().split()
	print('YES' if l.count('1') % 2 == 0 and l.count('2') % 2 == 0 or (l.count('1') >= 2 and (l.count('2') + 1) % 2 == 0 and ((l.count('1') - 2) % 2 == 0)) else 'NO')
for t in range(int(input())):
	Solve()


n = int(input())
ans = []
for i in range(n):
	N = int(input())
	cand = input().split()
	c1 = cand.count('1')
	c2 = cand.count('2')
	if c1 % 2 != 0:
		ans.append('NO')
	elif c2 % 2 == 0:
		ans.append('YES')
	elif c1 > 1:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


t = int(input())
ans = []
for i in range(0, t):
	n = int(input())
	l1 = list(map(int, input().split()))
	su1 = sum(l1)
	even = l1.count(2)
	odd = l1.count(1)
	if n % 2 == 0:
		if su1 % 2 == 0:
			ans.append('YES')
		else:
			ans.append('NO')
	elif odd == 0 or even == 0:
		ans.append('NO')
	elif even % 2 == 0 and odd % 2 == 1:
		ans.append('NO')
	else:
		ans.append('YES')
for i in ans:
	print(i)


x = int(input())
odg = []
for i in range(0, x):
	n = input()
	l = input()
	ones = l.replace(' ', '').replace('2', '')
	twos = l.replace(' ', '').replace('1', '')
	duljina2 = len(twos)
	duljina1 = len(ones)
	if duljina1 % 2:
		odg.append('NO')
	elif not duljina1 % 2 and (not duljina2 % 2):
		odg.append('YES')
	elif not duljina1 % 2 and duljina2 % 2:
		if duljina1 >= 2:
			odg.append('YES')
		else:
			odg.append('NO')
for e in odg:
	print(e)


testcase = int(input())
c = []
while testcase:
	toffe = int(input())
	weight = input()
	a = weight.count('1')
	b = weight.count('2')
	if (a + 2 * b) % 2 == 0:
		if a == 0 and b % 2 != 0:
			c.append('NO')
		else:
			c.append('YES')
	else:
		c.append('NO')
	testcase -= 1
p = '\n'.join(c)
print(p)


print('\n'.join((('NO', 'YES')[N1 % 2 == 0 and (N1 > 1 or (len(L) - N1) % 2 == 0)] for L in [z.split() for z in [*open(0)][2::2]] for N1 in [L.count('1')])))


from sys import stdin as sin, stdout as sout

def get_ints():
	return list(map(int, sin.readline().strip().split()))

def get_int():
	return int(sin.readline().strip())

def get_string():
	return sin.readline().strip()

def get_float():
	return float(sin.readline().strip)

def get_floats():
	return list(map(float, sin.readline().strip().split()))

def main():
	t = get_int()
	for i in range(t):
		solve()

def solve():
	n = get_int()
	lst = get_ints()
	sum = 0
	for i in lst:
		sum += i
	if sum % 2 != 0:
		print('NO')
	elif 1 in lst:
		print('YES')
	elif sum / 2 % 2 == 0:
		print('YES')
	else:
		print('NO')
main()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	c1 = a.count(1)
	c2 = n - c1
	if c1 % 2 == 1:
		ans.append('NO')
	elif c2 % 2 == 1 and c1 == 0:
		ans.append('NO')
	else:
		ans.append('YES')
print('\n'.join(ans))


from sys import stdin
n = int(stdin.readline())
for i in range(n):
	m = int(stdin.readline())
	k = list(map(int, stdin.readline().split()))
	cnt1 = k.count(1)
	cnt2 = k.count(2)
	sum = (cnt1 + 2 * cnt2) // 2
	if (cnt1 + 2 * cnt2) % 2 != 0:
		print('NO')
	elif sum % 2 == 0 or (sum % 2 == 1 and cnt1 != 0):
		print('YES')
	else:
		print('NO')


for _ in [*open(0)][2::2]:
	arr = list(map(int, _.split()))
	a = b = 0
	for i in arr:
		if i == 1:
			a += 1
		else:
			b += 1
	if a % 2:
		print('NO')
	elif b % 2 and a == 0:
		print('NO')
	else:
		print('YES')


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	one = a.count(1)
	if one >= 2 and one % 2 == 0:
		print('YES')
	elif one == 0:
		print('YES' if n % 2 == 0 else 'NO')
	else:
		print('NO')


import sys
tests = int(sys.stdin.readline().split()[0])
for test in range(tests):
	n = int(sys.stdin.readline().split()[0])
	a = [int(x) for x in sys.stdin.readline().split()]
	if sum(a) % 2 == 0:
		if n % 2 != 0 and min(a) == max(a):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


w = []
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) % 2 == 0 and (n % 2 == 0 or a.count(1) > 1):
		w.append('YES')
	else:
		w.append('NO')
print('\n'.join(w))


def fairDiv(n, candies):
	w = sum(candies)
	if w % 2 != 0:
		return 'NO'
	elif n % 2 != 0:
		if w == n * 2:
			return 'NO'
		else:
			return 'YES'
	else:
		return 'YES'

def main():
	tests = int(input())
	results = []
	for i in range(tests):
		n = int(input())
		w = list(map(int, input().split(' ')))
		results.append(fairDiv(n, w))
	for i in results:
		print(i)
main()


t = int(input())
answer = ''
for _ in range(t):
	n = int(input())
	candy = list(map(int, input().split()))
	if sum(candy) % 2 == 0 and (candy.count(2) % 2 == 0 or candy.count(1) > 0):
		answer += 'YES\n'
	else:
		answer += 'NO\n'
print(answer.strip())


i = int(input())
otv = []
for k in range(0, i):
	k = int(input())
	nb = list(map(int, input().split()))
	if sum(nb) % 2 == 0 and len(nb) % 2 == 0:
		otv.append('YES')
	elif sum(nb) % 2 == 0 and 1 in nb and (2 in nb):
		otv.append('YES')
	else:
		otv.append('NO')
print('\n'.join(otv))


def dulceDivision():
	t = int(input())
	respuesta = []
	for x in range(0, t):
		candies = int(input())
		lista = input().split(' ')
		c = 0
		bool = True
		for l in lista:
			if l == '1':
				c += 1
				bool = False
		if c % 2 == 0 and (not bool):
			respuesta.append('YES')
		elif bool and len(lista) % 2 == 0 and (c % 2 == 0):
			respuesta.append('YES')
		else:
			respuesta.append('NO')
	for e in respuesta:
		print(e)
dulceDivision()


from sys import stdin
from collections import Counter
from math import pow, sqrt, factorial, log10, log
from itertools import permutations, combinations, combinations_with_replacement
input = stdin.readline

def solve(n, a):
	if sum(a) & 1 or (1 not in a and n & 1):
		print('NO')
		return
	else:
		print('YES')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	solve(n, a)


TestCases = int(input(''))
Results = []
for c in range(TestCases):
	Sum = 0
	odd = False
	Candies = int(input(''))
	Values = list(map(int, input().split()))
	for v in Values:
		Sum += v
		if v == 1:
			odd = True
	if Sum % 2 == 0 and (odd or Candies % 2 == 0):
		Results.append('YES')
	else:
		Results.append('NO')
for r in Results:
	print(r)


A = []
t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	x = w.count(1)
	y = w.count(2)
	if x % 2 != 0:
		A.append('NO')
	elif y % 2 != 0 and x < 1:
		A.append('NO')
	else:
		A.append('YES')
for i in range(len(A)):
	print(A[i])


t = int(input())
r = []
for x in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	total1 = l.count(1)
	total2 = l.count(2)
	if total1 == total2 and total1 % 2 == 0:
		r.append('YES')
	elif n % 2 == 1 and total1 == 0:
		r.append('NO')
	elif n % 2 == 0 and total2 == 0 and (total1 % 2 == 0):
		r.append('YES')
	elif n % 2 == 1 and total2 % 2 == 1 and (total1 % 2 == 0):
		r.append('YES')
	elif n % 2 == 0 and total2 % 2 == 0 and (total1 % 2 == 0):
		r.append('YES')
	else:
		r.append('NO')
for x in r:
	print(x)


def konfetlarni_bulisha_oladimi(n, a):
	birlar_soni = 0
	ikkilar_soni = 0
	Sum = sum(a)
	for i in range(n):
		if a[i] == 1:
			birlar_soni += 1
		else:
			ikkilar_soni += 1
	if Sum % 2 == 1:
		return 'NO'
	elif n % 2 == 0 or (birlar_soni % 2 == 0 and birlar_soni > 0):
		return 'YES'
	else:
		return 'NO'
t = int(input())
natija = []
for i in range(t):
	n = int(input())
	a = input().split(' ')
	for i in range(n):
		a[i] = int(a[i])
	natija.append(konfetlarni_bulisha_oladimi(n, a))
for i in range(t):
	print(natija[i])


n = int(input())
for _ in range(n):
	x = input()
	arr = input().split()
	one = arr.count('1')
	two = arr.count('2')
	print('NO' if one % 2 or (two % 2 and (not one)) else 'YES')


for i in range(int(input())):
	total_candy = int(input())
	candy = input().split()
	one = candy.count('1')
	two = candy.count('2')
	if one % 2 == 0 and one > 0:
		print('YES')
	elif one == 0 and two % 2 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	res = 'NO'
	sa = sum(a)
	twos = a.count(2)
	if n == 1:
		print('NO')
		continue
	if n % 2 != 0 and (n - twos) % 2 == 0 and (twos != n):
		res = 'YES'
	elif sa % 2 == 0 and n % 2 == 0:
		res = 'YES'
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split(' ')
	t1 = 0
	t2 = 0
	for x in a:
		if x == '1':
			t1 += 1
		else:
			t2 += 1
	if t1 % 2 != 0:
		print('NO')
	elif t2 % 2 == 0:
		print('YES')
	elif t1 >= 2:
		print('YES')
	else:
		print('NO')


x = int(input())
for _ in range(x):
	n = int(input())
	lst = input().split()
	d = 0
	s = 0
	for i in lst:
		if i == '1':
			s += 1
		else:
			d += 1
	if d % 2 == 0:
		if s % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif s % 2 == 0 and s > 1:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ones = twos = 0
		for c in input().split():
			if c == '1':
				ones += 1
			else:
				twos += 1
		if ones % 2 or (ones == 0 and twos % 2):
			print('NO')
		else:
			print('YES')
main()


t = int(input())
for i in range(t):
	n = int(input())
	tas = list(map(int, input().split()))
	total = sum(tas)
	if total % 2 != 0:
		print('NO')
	elif n % 2 == 0:
		print('YES')
	else:
		result = all((element == tas[0] for element in tas))
		if result:
			print('NO')
		else:
			print('YES')


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	c2 = arr.count(1)
	if c2 >= 2 and sum(arr) % 2 == 0:
		print('YES')
	elif c2 == 0 and n % 2 == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	b = int(input())
	c = input().split()
	d = c.count('1')
	e = c.count('2')
	if b == 1:
		print('NO')
	elif b == 2:
		if d == e:
			print('NO')
		else:
			print('YES')
	elif b % 2 == 0:
		if e % 2 == 0:
			print('YES')
		elif d % 2 != 0:
			print('NO')
	elif b % 2 != 0:
		if d == b or e == b:
			print('NO')
		elif e % 2 == 0:
			print('NO')
		elif d % 2 == 0:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	d = 0
	ones = 0
	for i in range(n):
		k = next(a)
		if k == 1:
			ones += 1
		if d == 0 and k == 2 and (ones >= 2):
			d = 0
		else:
			d = abs(d - k)
	if d == 0:
		print('YES')
	else:
		print('NO')


t1 = int(input())
for i in range(t1):
	n = int(input())
	c = 0
	a = list(map(int, input().split()))
	if n % 2 == 0 and sum(a) % 2 == 0:
		print('YES')
		continue
	if sum(a) % 2 == 1:
		print('NO')
		continue
	if n % 2 == 1 and sum(a) % 2 == 0:
		p = a.count(1)
		if p % 2 == 0 and p != 0:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	n = int(input())
	a = [int(i) for i in input().split()]
	if sum(a) % 2 == 0 and a.count(1) >= 2 or (a.count(2) % 2 == 0 and a.count(1) == 0):
		print('YES')
	else:
		print('NO')


q = input
for i in range(int(q())):
	n = q()
	a = q()
	k = a.count('2')
	m = a.count('1')
	print('NYOE S '[m != 0 and m % 2 == 0 or (m == 0 and k % 2 == 0)::2])


t = int(input())
for test in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if sum(a) % 2 == 0:
		if n % 2 != 0 and min(a) == max(a):
			print('NO')
		else:
			print('YES')
		pass
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	if sum(s) % 2 != 0:
		print('NO')
	elif 1 in s:
		print('YES')
	elif len(s) % 2 == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	s = int(input())
	a = input().split()
	x = a.count('2')
	z = a.count('1')
	if x == 0 and z % 2 == 0:
		print('YES')
	elif x % 2 == 0 and z == 0:
		print('YES')
	elif z != 0 and z % 2 == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l.count(1)
	b = l.count(2)
	if a > 0 and a % 2 == 0:
		print('YES')
	elif a == 0 and b % 2 == 0:
		print('YES')
	else:
		print('NO')


def solution(candies, quantities):
	aliceQt = 0
	bobQt = 0
	quantities.sort(reverse=True)
	for num in quantities:
		if aliceQt < bobQt:
			aliceQt += int(num)
		else:
			bobQt += int(num)
	if aliceQt == bobQt:
		print('YES')
	else:
		print('NO')

def main():
	testCases = int(input())
	for i in range(testCases):
		sample = int(input())
		array = input().split(' ')
		solution(sample, array)
main()


for _ in range(int(input())):
	input()
	a = input()
	one = a.count('1')
	two = a.count('2')
	if one == 1 and two == 1 or (one == 0 and two & 1) or (two == 0 and one & 1) or one - two * 2 & 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	t = int(input())
	a = [int(x) for x in input().split()]
	if a.count(1) % 2 == 0:
		if 1 in a:
			print('YES')
		elif a.count(2) % 2 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	if sum(l) % 2 == 1:
		print('NO')
	elif sum(l) % 4 == 0:
		print('YES')
	elif l.count(1) >= 2:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	n = int(fastinput())
	(c1, c2) = (0, 0)
	for i in fastinput().split():
		if i == '1':
			c1 += 1
		else:
			c2 += 1
	if c1 == 0 and c2 % 2 == 1:
		print('NO')
	elif c1 != 0 and (c1 + 2 * c2) % 2 != 0:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	(*li,) = map(int, input().split())
	if x % 2 == 0 and sum(li) % 2 == 0:
		print('YES')
	elif x % 2 != 0 and li.count(1) % 2 == 0 and (li.count(1) > 0):
		print('YES')
	else:
		print('NO')


def solve(ls):
	for i in range(len(ls)):
		sum1 = 0
		sum2 = 0
		for j in ls[i]:
			if j == '1':
				sum1 += 1
			else:
				sum2 += 2
		if sum1 == 0 and sum2 // 2 % 2 == 0:
			print('YES')
		elif sum2 == 0 and sum1 % 2 == 0:
			print('YES')
		elif sum1 % 2 == 0 and sum2 % 2 == 0 and (sum1 != 0) and (sum2 != 0):
			print('YES')
		else:
			print('NO')
t = int(input())
x = []
for i in range(t):
	n = int(input())
	x += [input().split()]
b = solve(x)


import sys
tests = int(sys.stdin.readline())
for _ in range(tests):
	t = int(sys.stdin.readline())
	ws = list(map(int, sys.stdin.readline().split()))
	ones = ws.count(1)
	twos = ws.count(2)
	if ones % 2 == 1:
		print('NO')
	elif twos % 2 == 0:
		print('YES')
	elif twos % 2 == 1:
		if ones < 2:
			print('NO')
		else:
			print('YES')


from sys import stdin
inp = stdin.read()
lst = list(map(int, inp.split()))
t = lst[0]
s = 1
for _ in range(t):
	n = lst[s]
	s += 1
	c = lst[s:s + n]
	s += n
	(n1, n2) = (0, 0)
	for i in c:
		if i == 1:
			n1 += 1
		else:
			n2 ^= 1
	if n1 % 2 == 1:
		print('NO')
	elif n1 == 0 and n2 % 2 == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
answers = []
for i in range(t):
	n = int(input())
	candies = input().split(' ')
	candies = list(map(int, candies))
	alice = 0
	bob = 0
	for candy in sorted(candies, reverse=True):
		if bob > alice:
			alice += candy
		else:
			bob += candy
	if alice == bob:
		answers.append('YES')
	else:
		answers.append('NO')
for answer in answers:
	print(answer)


import sys
sys.setrecursionlimit(1000000)
from collections import defaultdict, deque, Counter
from itertools import permutations
from math import sqrt, gcd, pi, factorial
from functools import reduce
from sys import stdin
from bisect import bisect_right, bisect_left
from copy import copy

def solve(n, a):
	cnt2 = a.count(2)
	cnt1 = n - cnt2
	for i in range(cnt2 + 1):
		sum1 = 2 * i
		sum2 = 2 * (cnt2 - i)
		if abs(sum1 - sum2) <= cnt1 and (cnt1 - abs(sum1 - sum2)) % 2 == 0:
			return True
	return False
t = int(input())
anss = [False for _ in range(t)]
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	anss[i] = solve(n, a)
for ans in anss:
	if ans:
		print('YES')
	else:
		print('NO')


lines = int(input())
rounds = []

def play(game):
	game.sort()
	game.reverse()
	alice = 0
	bob = 0
	for candy in game:
		if alice < bob:
			alice = alice + candy
		else:
			bob = bob + candy
	if alice == bob:
		print('YES')
	else:
		print('NO')
for i in range(0, lines):
	input()
	rounds.append(input().split(' '))
for x in rounds:
	x = list(map(int, x))
	play(x)


def init_para():
	n = int(input())
	arr = []
	get_arr = input().split()
	for i in range(n):
		arr.append(int(get_arr[i]))
	return (n, arr)

def is_satisfy(arr, n):
	sum = 0
	for i in range(n):
		sum += arr[i]
	if sum % 2 == 1:
		return 'NO'
	half = int(sum / 2)
	arr.sort()
	for i in range(n - 1, 0, -1):
		half -= arr[i]
		if half == 0:
			return 'YES'
		if half < 0:
			half = int(sum / 2) - arr[i]
	return 'NO'
no_test = int(input())
res = []
for i in range(no_test):
	(n, arr) = init_para()
	res.append(is_satisfy(arr, n))
for r in res:
	print(r)


t = int(input())
rlist = []
for _ in range(t):
	n = int(input())
	weights = sorted(list(map(int, input().split(' '))), reverse=True)
	(a, b) = (0, 0)
	for w in weights:
		if a <= b:
			a += w
		else:
			b += w
	if a == b:
		rlist.append('YES')
	else:
		rlist.append('NO')
for i in rlist:
	print(i)


for _ in range(int(input())):
	n = int(input())
	line = input()
	count1 = line.count('1')
	count2 = line.count('2')
	print(['YES', 'NO'][count1 % 2 == 1 or (count1 == 0 and count2 % 2 == 1)])


loops = int(input())
for each in range(loops):
	howManyCandies = int(input())
	candiesWeight = input()
	candiesTab = candiesWeight.split(' ')
	count1 = candiesTab.count('1')
	count2 = candiesTab.count('2')
	if count1 == 0 and count2 % 2 != 0:
		print('NO')
	elif count1 % 2 == 0 and count2 == 0 or (count2 % 2 == 0 and count1 == 0):
		print('YES')
	elif count1 % 2 == 0 and count2 > 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	a = b = 0
	for i in input().split():
		if i == '2':
			b += 1
		else:
			a += 1
	if a & 1 or (b & 1 and a < 2):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	one = two = 0
	for i in a:
		if i == 1:
			one += 1
		else:
			two += 1
	if two % 2 == 0:
		if one % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif one % 2 == 0 and one != 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	o = li.count(1)
	t = li.count(2)
	if o == 0 and t % 2 == 0:
		print('YES')
	elif t == 0 and o % 2 == 0:
		print('YES')
	elif o % 2 == 0 and t % 2 == 0:
		print('YES')
	elif o % 2 != 0 and t % 2 == 0 and (t == o):
		print('YES')
	elif o % 2 == 0 and t % 2 != 0 and (o > 1):
		print('YES')
	else:
		print('NO')