insect-colony-2

Yesterday Oz heard a story about insect colony. The specialty of insects is that they splits sometimes i.e an insect of size A can split into two insects of positive integral sizes B and C such that A = B + C. Also sometimes they attack each other i.e. two insects of sizes P and Q will become R = P XOR Q .
You are given the sizes of the insects of insect colony, you have to determine whether it is possible for insect colony to disappear after several splits and/or attacks? 

Input : 
The first line contains an integer T, indicating the number of test cases.
For each test case, the first line contains an integer N, indicating the number of insects in insect colony, followed by N space separated positive integers p1,p2,...,pN denoting the sizes of insects.

Output :
For each test case, output "Yes" if it is possible for insect colony to disappear after several splits and/or attacks otherwise output "No" (quotes for clarity only)

Constraints :
1 ≤ T ≤ 100
1 ≤ N ≤ 100
1 ≤ pi ≤ 10^9 where i =1,2...,N

SAMPLE INPUT
2
2 9 17
1 1

SAMPLE OUTPUT
Yes
No

Explanation

For the first sample :
Following is one possible sequence of operations  - 
1)  attack i.e 9 XOR 17 = 24
2)  split 24 into two parts each of size 12
3)  attack i.e 12 XOR 12 = 0
as the size is now 0 so it is possible for the colony to disappear.

Difficulty: EASY

Starter code:

Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = int(input())
for i in range(n):
	n_i = [int(x) for x in input().split()]
	x = 1
	for i in range(1, len(n_i)):
		if (n_i[i] & 1) == 1:
			x = x^1
	if x == 1:
		print("Yes")
	else:
		print("No")


if __name__ == '__main__':
	t = int(input())
	for each in range(t):
		n = (list(map(int, input().split())))
		assert n[0] is len(n[1:]) and len(n[1:]) < 101
		insect_list = n[1:]
		temp = insect_list[:]
		while True:
			insect_list[:] = (value for value in insect_list if value != 0)
			if len(insect_list) == 0:
				print('Yes')
				break
			if len(insect_list) > 1:
				if insect_list[0] % 2 != 0:
					temp_var = insect_list[0] ^ insect_list[1]
					insect_list.pop(1)
					insect_list.pop(0)
					insect_list.insert(0, temp_var)
				else:
					insect_list.pop(0)
			elif insect_list[0] % 2 == 0:
				insect_list.pop(0)
			else:
				print('No')
				break


t=int(input())
while(t):
	t=t-1
	n=input()
	n=n.split()
	count=0;
	for i in range(1,len(n)):
		num=int(n[i])
		if(num%2==1):
			count+=1
	if(count%2==0):
		print("Yes")
	else:
		print("No")


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input());
for i in range(0,t):
	result = 0
	p = input().split()[1:];
	for j in p:
		result = result ^ int(j);
	print("Yes" if ((result == 0) or (result % 2 == 0)) else "No");


t=eval(input())
for i in range(0,t):
	a=list(map(int,input().split()))
	s=0
	l=a[0]
	for j in range(1,l+1):
		s=s+a[j]
	if(s%2==0):
		print("Yes")
	else:
		print("No")


n=eval(input())
for i in range(n):
	c=0
	a=list(range(100))
	a = list(map(int, input().split()))
	m=a[0]
	if m==1:
		print("No")
	if m!=1:	
		for i in range(1,m+1):
			if a[i]%2!=0:
				c=c+1
		if c%2==0:
			print("Yes")
		if c%2!=0:
			print("No")
			


TC = int(input())

while TC >= 1:
	insects = list(map(int, input().split()))
	N = insects.pop(0)
	#print 'N is: %d' % N
	total_odd = 0
	#print 'insects array is: {0}'.format(insects)

	for index, value in enumerate(insects):
		#print 'i is: %d' % value
		if value % 2 == 0:
			continue
		else:
			total_odd += 1

	if total_odd % 2 == 0:
		print('Yes')
	else:
		print('No')

	TC = TC -1


t = int(input())
for i in range(t):
	arr = list(map(int,input().split()))
	arr = arr[1:]
	ans = sum(arr)
	if ans%2 == 1:
	    print('No')
	else:
	    print('Yes')


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input());
for i in range(0,t):
	result = 0
	p = input().split()[1:];
	for j in p:
		result = result ^ int(j);
	print("Yes" if ((result == 0) or (result % 2 == 0)) else "No");


t = int(input())

for i in range(t):
	a = list(map(int, input().strip().split(' ')))
	numOdds=0
	for i in range(1, a[0]+1):
		if a[i]%2!=0:
			numOdds+=1

	if numOdds%2!=0:
		print("No")
	else:
		print("Yes")


n = eval(input())
for i in range(n):
	all_xor = 0
	inp = input().split()
	for j in range(int(inp[0])):
		all_xor ^= int(inp[j+1])
	if all_xor%2 == 0:
		print("Yes")
	else:
		print("No")