Baby Ehab is known for his love for a certain operation. He has an array $a$ of length $n$, and he decided to keep doing the following operation on it:

he picks $2$ adjacent elements; he then removes them and places a single integer in their place: their bitwise XOR . Note that the length of the array decreases by one.

Now he asks you if he can make all elements of the array equal. Since babies like to make your life harder, he requires that you leave at least $2$ elements remaining.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 15$) — the number of test cases you need to solve.

The first line of each test case contains an integers $n$ ($2 \le n \le 2000$) — the number of elements in the array $a$.

The second line contains $n$ space-separated integers $a_1$, $a_2$, $\ldots$, $a_{n}$ ($0 \le a_i < 2^{30}$) — the elements of the array $a$.


-----Output-----

If Baby Ehab can make all elements equal while leaving at least $2$ elements standing, print "YES". Otherwise, print "NO".


-----Examples-----

Input
2
3
0 2 2
4
2 3 1 10
Output
YES
NO


-----Note-----

In the first sample, he can remove the first $2$ elements, $0$ and $2$, and replace them by $0 \oplus 2=2$. The array will be $[2,2]$, so all the elements are equal.

In the second sample, there's no way to make all the elements equal.

Difficulty: MEDIUM

Solutions:
import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	Result = [0]
	for a in A:
		Result.append(Result[-1] ^ a)
	r = Result[-1]
	if not r:
		b = 0
	else:
		idx = Result.index(r)
		if idx < n:
			S = set(Result[idx + 1:])
			if 0 in S:
				b = 0
			else:
				b = 1
		else:
			b = 1
	print('YNEOS'[b::2])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(xor, acc_a, pos0) = (0, [], [])
	for i in range(n):
		xor ^= a[i]
		acc_a.append(xor)
		if xor == 0:
			pos0.append(i)
	if xor == 0:
		print('YES')
	else:
		T = len(pos0) > 0 and xor in acc_a[:pos0[-1]]
		print('YES' if T else 'NO')


import math
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = a[0]
	for i in range(1, n):
		ans = ans ^ a[i]
	if ans == 0:
		print('YES')
	else:
		ok = 0
		count = 0
		for i in range(n):
			ok = ok ^ a[i]
			if ok == ans:
				count += 1
				ok = 0
		if count >= 2:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	input()
	l = list(map(int, input().split()))
	v = []
	for x in l:
		if not v:
			v.append(x)
		else:
			v.append(x ^ v[-1])
	if v[-1] == 0:
		print('YES')
	else:
		ok = False
		for i in range(1, len(l)):
			for j in range(i + 1, len(l)):
				v1 = v[i - 1]
				v2 = v[j - 1] ^ v[i - 1]
				v3 = v[-1] ^ v[j - 1]
				if v1 == v2 == v3:
					print('YES')
					ok = True
					break
			if ok:
				break
		if not ok:
			print('NO')


import sys
import math
import bisect
import functools
from functools import lru_cache
from sys import stdin, stdout
from math import gcd, floor, sqrt, log, ceil
from heapq import heappush, heappop, heapify
from collections import defaultdict as dd
from collections import Counter as cc
from bisect import bisect_left as bl
from bisect import bisect_right as br

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
sys.setrecursionlimit(100000000)
intinp = lambda : int(input().strip())
stripinp = lambda : input().strip()
fltarr = lambda : list(map(float, input().strip().split()))
intarr = lambda : list(map(int, input().strip().split()))
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
MOD = 1000000007
num_cases = intinp()
for _ in range(num_cases):
	n = intinp()
	arr = intarr()
	x = 0
	for v in arr:
		x ^= v
	y = 0
	ans = 0
	if not x:
		print('YES')
		continue
	for v in arr:
		y ^= v
		if y == x:
			y = 0
			ans += 1
	if not y and ans > 1:
		print('YES')
	else:
		print('NO')


import sys

def solve(arr, n):
	res = 0
	for elem in arr:
		res ^= elem
	if res == 0:
		return 'YES'
	a = 0
	for i in range(n):
		a ^= arr[i]
		if a == res:
			break
	b = 0
	for i in range(i + 1, n):
		b ^= arr[i]
		if b == res:
			break
	return 'YES' if i != n - 1 else 'NO'

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		res += solve(a, n) + '\n'
	print(res)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	for x in a:
		s ^= x
	if s == 0:
		print('YES')
	else:
		c = 0
		ps = 0
		for i in range(n):
			ps ^= a[i]
			if ps == s:
				c += 1
				ps = 0
		if c >= 2:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	preXor = [0] * n
	flag = False
	for i in range(n):
		if i == 0:
			preXor[i] = a[i]
		else:
			preXor[i] = preXor[i - 1] ^ a[i]
	for j in range(n - 1):
		if preXor[j] == preXor[n - 1] ^ preXor[j]:
			flag = True
			break
	for i in range(n):
		for j in range(i + 1, n - 1):
			if preXor[i] == preXor[i] ^ preXor[j] and preXor[i] == preXor[j] ^ preXor[n - 1]:
				flag = True
				break
		if flag:
			break
	if flag:
		sys.stdout.write('YES' + '\n')
	else:
		sys.stdout.write('NO' + '\n')


import math, sys
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
MOD = int(1000000000.0) + 7

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	pre = [0 for i in range(n)]
	suf = [0 for i in range(n)]
	x = 0
	for i in range(n):
		x ^= arr[i]
		pre[i] = x
	if x == 0:
		print('YES')
		return
	s = 0
	for i in range(n - 1, -1, -1):
		s ^= arr[i]
		suf[i] = s
	for i in range(n - 2):
		p = pre[i]
		m = arr[i + 1]
		for j in range(i + 2, n):
			s = suf[j]
			if p == m == s:
				print('YES')
				return
			m ^= arr[j]
	print('NO')
t = 1
t = int(input())
for _ in range(t):
	main()


t = int(input())
while t:
	t = t - 1
	n = int(input())
	l = list(map(int, input().split()))
	ans = l[0]
	for i in range(1, n):
		ans ^= l[i]
	if ans == 0:
		print('YES')
	else:
		check = 0
		count = 0
		for i in range(0, n):
			check ^= l[i]
			if ans == check:
				count += 1
				check = 0
		if count >= 2:
			print('YES')
		else:
			print('NO')


def solve(arr):
	n = len(arr)
	if arr[-1] == 0:
		return 'YES'
	for i in range(n - 2):
		if arr[i] == arr[-1]:
			for j in range(i + 1, n - 1):
				if arr[j] == 0:
					return 'YES'
	return 'NO'
T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	xor = a[0]
	xors = [xor]
	for x in a[1:]:
		xor ^= x
		xors.append(xor)
	result = solve(xors)
	print(result)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	xor = 0
	for x in arr:
		xor ^= x
	if xor == 0:
		print('YES')
	else:
		count = block = 0
		for x in arr:
			count ^= x
			if count == xor:
				block += 1
				count = 0
		print('YES' if block > 2 else 'NO')


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter, defaultdict, deque
from pprint import pprint
from itertools import permutations
from bisect import bisect_right
from random import randint as rti
MOD = 10 ** 9 + 7

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	total = 0
	for i in arr:
		total ^= i
	til = 0
	for i in range(n - 1):
		til ^= arr[i]
		if til == total ^ til:
			print('YES')
			return
	pf = 0
	for i in range(n):
		pf ^= arr[i]
		till = 0
		for j in range(i + 1, n - 1):
			till ^= arr[j]
			if pf == till == total ^ till ^ pf:
				print('YES')
				return
	print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


t = int(input())

def full_xor(a):
	res = 0
	for ai in a:
		res = res ^ ai
	return res
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	res = 0
	xors = []
	for ai in a:
		res = res ^ ai
		xors.append(res)
	if res != 0:
		if xors.count(res) > 1:
			first = xors.index(res)
			new = xors[first:]
			if 0 in new:
				res = 0
		if xors.count(res) > 1:
			first = xors.index(res)
			second = first + 1 + xors[first + 1:].index(res)
			new = a[second + 1:]
			if full_xor(new) == res:
				res = 0
	print('YES' if res == 0 else 'NO')


import sys

def f(l, n):
	fullxor = l[0]
	for i in range(1, n):
		fullxor = fullxor ^ l[i]
	if fullxor == 0:
		return 'YES'
	else:
		var = 0
		c = 0
		for j in range(n - 1):
			var = var ^ l[j]
			if var == fullxor:
				c = c + 1
				var = 0
		if c >= 2:
			return 'YES'
		else:
			return 'NO'
t = int(input())
i = 0
while i != t:
	i = i + 1
	n = int(input())
	x = input().split(' ')
	y = [int(o) for o in x]
	print(f(y, n))


import sys
input = sys.stdin.readline
t = int(input())
for i1 in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f2 = 0
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x = x ^ l[j]
		j1 = i + 1
		while j1 < n:
			y = 0
			f = 0
			for j2 in range(j1, n):
				y = y ^ l[j2]
				if y == x:
					j1 = j2 + 1
					f = 1
			if f == 0:
				break
		if f == 1:
			print('YES')
			f2 = 1
			break
	if f2 == 0:
		print('NO')


from os import path
import sys, time
mod = int(1000000000.0 + 7)
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from bisect import *
from functools import reduce
from operator import mul
star = lambda x: print(' '.join(map(str, x)))
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
INF = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import sys
from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def inlt():
	return list(map(int, stdin.readline().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, stdin.readline().split())

def pr(n):
	return stdout.write(str(n) + '\n')
from copy import deepcopy

def solve():
	n = inp()
	a = inlt()
	ff = False
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x = x ^ a[j]
		t = 0
		flag = False
		for k in range(i + 1, n):
			t = t ^ a[k]
			if t == x:
				t = 0
				flag = True
		if not t and flag:
			print('YES')
			ff = True
			break
	if not ff:
		print('NO')
t = 1
t = inp()
for _ in range(t):
	solve()


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2, sqrt
import bisect
import copy
from itertools import combinations
import sys

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

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

def input():
	return sys.stdin.readline().strip()
import heapq
for _ in range(int(input())):
	n = int(input())
	a = get_array()
	ans = 0
	for i in range(1, n):
		a[i] ^= a[i - 1]
	for i in range(n):
		if a[i] == a[n - 1] ^ a[i]:
			ans = 1
			break
	for i in range(n):
		val = a[i]
		if a[n - 1] ^ a[i] == 0:
			for j in range(i + 1, n):
				if a[j] ^ a[i] == val:
					ans = 1
					break
	if ans == 1:
		print('YES')
	else:
		print('NO')


from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from sys import *
from re import *

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
num = int(z())
for _ in range(num):
	n = int(z())
	arr = zzz()
	xr = arr[0]
	for i in range(1, n):
		xr ^= arr[i]
	if xr == 0:
		print('YES')
	else:
		cnt = 0
		new = 0
		for i in range(n):
			new ^= arr[i]
			if new == xr:
				cnt += 1
				new = 0
		if cnt >= 2:
			print('YES')
		else:
			print('NO')


import sys
times = int(input())
for i in range(times):
	n = int(input())
	values = list(map(int, input().split()))
	targ = 0
	for i in values:
		targ ^= i
	if targ == 0:
		print('YES')
		continue
	xor_val = 0
	count = 0
	for i in range(0, n):
		xor_val ^= values[i]
		if xor_val == targ:
			count += 1
			xor_val = 0
	if xor_val == 0 and count > 1:
		print('YES')
		continue
	else:
		print('NO')


import sys, math, itertools, random, bisect
from collections import defaultdict
INF = 10 ** 18

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

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

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
test = 1
test = int(input())
for _ in range(test):
	(n,) = get_ints()
	a = get_array()
	x = 0
	for i in range(n):
		x ^= a[i]
	if x == 0:
		print('YES')
	else:
		ele = x
		x = 0
		ct = 0
		for i in range(n):
			x ^= a[i]
			if x == ele:
				x = 0
				ct += 1
		if x == ele or (x == 0 and ct > 1):
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	for v in a:
		x ^= v
	if x == 0:
		print('YES')
	else:
		y = a[0]
		si = 0
		while y != x:
			si += 1
			if si >= n:
				break
			y ^= a[si]
		z = a[n - 1]
		ei = n - 1
		while z != x:
			ei -= 1
			if ei <= si:
				break
			z ^= a[ei]
		if si < n - 1 and ei > 0 and (ei - si - 1 > 0):
			print('YES')
		else:
			print('NO')


from sys import stdin
from sys import stdout
from math import *
import sys
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	f = []
	b = []
	x = 0
	for i in range(n):
		f.append(x ^ ar[i])
		x = x ^ ar[i]
	x = 0
	for i in range(n - 1, -1, -1):
		b.append(x ^ ar[i])
		x = x ^ ar[i]
	b = b[::-1]
	if f[-1] == 0:
		print('YES')
	else:
		p = 0
		for i in range(n):
			for j in range(n - 1, i, -1):
				x = f[j - 1] ^ f[i]
				if f[i] == b[j] == x:
					p = 1
		if p:
			print('YES')
		else:
			print('NO')


def main():
	t = int(input())
	allans = []
	for _ in range(t):
		n = int(input())
		a = readIntArr()
		suffixXor = [-1 for _ in range(n)]
		x = 0
		for i in range(n - 1, -1, -1):
			x ^= a[i]
			suffixXor[i] = x
		ans = 'NO'
		px = 0
		prevXors = set()
		for i in range(n - 1):
			px ^= a[i]
			s = suffixXor[i + 1]
			if px == s:
				ans = 'YES'
				break
			if px == 0 and s in prevXors:
				ans = 'YES'
				break
			prevXors.add(px)
		allans.append(ans)
	multiLineArrayPrint(allans)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultVal, dimensionArr):
	dv = defaultVal
	da = dimensionArr
	if len(da) == 1:
		return [dv for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import sys
from itertools import combinations
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, sys.stdin.readline().split()))
	flag = 0
	acc = [arr[0]]
	for i in arr[1:]:
		acc.append(acc[-1] ^ i)
	for b in range(n - 1):
		if acc[b] == acc[b] ^ acc[-1]:
			flag = 1
			break
	for (b1, b2) in combinations([i for i in range(n)], 2):
		if acc[b1] == acc[b1] ^ acc[b2] == acc[b2] ^ acc[-1]:
			flag = 1
			break
	print('YES' if flag else 'NO')


from __future__ import print_function
from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gil()
	n = len(a)
	ans = False
	s = 0
	for i in range(n - 1):
		s ^= a[i]
		cnt = 0
		base = 0
		for j in range(i + 1, n):
			base ^= a[j]
			if base == s:
				base = 0
				cnt += 1
		if base == 0 and cnt:
			ans = True
			break
	print('YES' if ans else 'NO')


def solve(l):
	xor = 0
	for i in l:
		xor ^= i
	if xor == 0:
		return True
	else:
		n = len(l)
		yor = 0
		c = 0
		for i in range(n):
			yor ^= l[i]
			if yor == xor:
				yor = 0
				c += 1
		if yor == 0 and c > 1:
			return True
		else:
			return False
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print('YES' if solve(l) else 'NO')


cases = int(input())
for _ in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		x1 = 0
		for j in range(i + 1):
			x1 ^= a[j]
		x2 = 0
		cnt = 0
		for j in range(i + 1, n):
			x2 ^= a[j]
			if x2 == x1:
				x2 = 0
				cnt += 1
		if x2 == 0 and cnt > 0:
			flag = 1
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor ^= a[i]
	if xor == 0:
		print('YES')
	else:
		cnt = 0
		xr = 0
		for i in range(n):
			xr ^= a[i]
			if xor == xr:
				cnt += 1
				xr = 0
		if cnt >= 2:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	x = int(input())
	a = list(map(int, input().split()))
	an = 0
	for i in a:
		an = an ^ i
	flag = 0
	if an == 0:
		flag = 1
	c = 0
	f = 0
	for i in a:
		f = f ^ i
		if f == an:
			c += 1
			f = 0
	if c > 2:
		flag = 1
	if flag:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	check = arr[0]
	for x in arr[1:]:
		check = check ^ x
	if check == 0:
		print('YES')
	else:
		done = False
		left = 0
		mid = 0
		right = 0
		for i in range(n):
			left = left ^ arr[i]
			if check ^ left != 0:
				continue
			mid = 0
			right = 0
			for j in range(i + 1, n - 1):
				mid = mid ^ arr[j]
				right = check ^ mid ^ left
				if left == mid and mid == right:
					print('YES')
					done = True
					break
			if done:
				break
		if not done:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pre = [-1] * n
	pre[0] = l[0]
	for i in range(1, n):
		pre[i] = l[i] ^ pre[i - 1]
	flag = False
	for i in range(n - 1):
		if pre[i] == pre[n - 1] ^ pre[i]:
			flag = True
			break
	if not flag:
		for i in range(n - 2):
			start = pre[i]
			for j in range(i + 1, n - 1):
				mid = pre[j] ^ pre[i]
				end = pre[n - 1] ^ pre[j]
				if start == mid and mid == end:
					flag = True
					break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = a[0]
	for i in range(1, n):
		s = s ^ a[i]
	if s == 0:
		print('YES')
	else:
		s = a[0]
		c = 0
		for i in range(1, n):
			s = s ^ a[i]
			if s == 0:
				c = i
				break
		s = 0
		for i in range(c + 1, n):
			s = s ^ a[i]
		d = 0
		z = 0
		for i in range(c + 1):
			d = d ^ a[i]
			if d == s:
				z += 1
				d = 0
		if z == 2 and d == 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	ls = [int(x) for x in input().split()]
	xorsum = 0
	ans = 0
	for i in ls:
		xorsum ^= i
	if xorsum == 0:
		ans = 1
	if ans == 0:
		xorsum2 = 0
		cnt = 0
		for i in ls:
			xorsum2 ^= i
			if xorsum2 == xorsum:
				xorsum2 = 0
				cnt += 1
	if ans == 0:
		if xorsum2 == 0 and cnt >= 3:
			ans = 1
	if ans == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor ^= a[i]
	if xor == 0:
		print('YES')
	else:
		xort = 0
		i = 0
		while i < n - 1:
			xort ^= a[i]
			if xort == xor:
				break
			i += 1
		if i == n - 2:
			print('NO')
		else:
			xort = 0
			i = i + 1
			while i < n:
				xort ^= a[i]
				if xort == xor:
					break
				i += 1
			if i == n - 1:
				print('NO')
			else:
				xort = 0
				i += 1
				while i < n:
					xort ^= a[i]
					i += 1
				if xort == xor:
					print('YES')
				else:
					print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	res = 0
	for i in range(n):
		res ^= arr[i]
	if res == 0:
		print('YES')
	else:
		count = 0
		xor = 0
		for i in range(n):
			xor ^= arr[i]
			if xor == res:
				count += 1
				xor = 0
		if count >= 2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	for x in a:
		s ^= x
	if s == 0:
		print('YES')
	else:
		cnt = 0
		i = 0
		t = 0
		while i < n:
			t ^= a[i]
			i += 1
			if t == s:
				t = 0
				cnt += 1
		if t != 0 or cnt == 1:
			print('NO')
		else:
			print('YES')


from collections import Counter
import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		x = a[0]
		for i in range(1, n):
			x = x ^ a[i]
		if x == 0:
			print('YES')
		else:
			c = 0
			j = 0
			flag = 0
			m = a[j]
			while m == x:
				c += 1
				j += 1
				if j < n:
					m = a[j]
				else:
					break
			while j < n:
				while m != x:
					j += 1
					if j == n:
						break
					m = m ^ a[j]
				if m == x:
					c += 1
					j += 1
					if j < n:
						m = a[j]
				elif m == 0:
					j += 1
					if j < n:
						m = a[j]
				else:
					flag = 1
			if flag == 0:
				if c > 2 and c % 2 == 1:
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
main()


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	d = 0
	ans = 0
	for k in arr:
		d ^= k
	if d == 0:
		print('YES')
	else:
		a = 0
		for j in range(n):
			a ^= arr[j]
			if a == d:
				ans += 1
				a = 0
		if ans >= 2:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	x = y = c = 0
	for s in a:
		x ^= s
	for s in a:
		y ^= s
		if y == x:
			c += 1
			y = 0
	if c > 1 or x == 0:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 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
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = lis()
		s = 0
		for x in arr:
			s ^= x
		if s == 0:
			print('YES')
		else:
			c = 0
			y = 0
			for i in range(n):
				y ^= arr[i]
				if y == s:
					c += 1
					y = 0
			if c >= 2:
				print('YES')
			else:
				print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	pfx = []
	xor = 0
	lst = -1
	for i in range(n):
		xor ^= ar[i]
		pfx.append(xor)
	if pfx[-1] == 0:
		print('YES')
		continue
	else:
		x = pfx[-1]
		(cnt, temp) = (0, 0)
		for i in range(n):
			temp = temp ^ ar[i]
			if temp == x:
				cnt += 1
				temp = 0
		if cnt >= 3:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in a:
		ans = ans ^ i
	if ans == 0:
		print('YES')
	else:
		x = 0
		ans1 = 0
		for i in a:
			x = x ^ i
			if x == ans:
				ans1 += 1
				x = 0
		if ans1 % 2 == 1 and ans1 > 2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	for i in range(n):
		sum ^= a[i]
	if sum == 0:
		print('YES')
		continue
	cur = 0
	count = 0
	for i in range(n):
		cur ^= a[i]
		if cur == sum:
			count += 1
			cur = 0
	if cur == 0 and count >= 3:
		print('YES')
	else:
		print('NO')


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('YES')
		continue
	totalXor = reduce(lambda x, y: x ^ y, a)
	if totalXor == 0:
		print('YES')
	else:
		x = 0
		c = 0
		for i in range(n):
			x ^= a[i]
			if x == totalXor:
				c += 1
				x = 0
		if c > 1:
			print('YES')
		else:
			print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	for i in arr:
		ans ^= i
	if ans == 0:
		print('YES')
		continue
	f = 0
	k = 0
	for i in range(n):
		f ^= arr[i]
		if f == ans:
			k = k + 1
			ans = 0
	if k > 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	p = 0
	flag = False
	for x in ls:
		p = p ^ x
	if p == 0:
		flag = True
	cnt = 0
	u = 0
	for i in range(n):
		u = u ^ ls[i]
		if u == p:
			cnt += 1
			u = 0
	if cnt >= 2 or flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())

def xor(arr, n):
	res = 0
	l = 0
	y = 0
	for i in arr:
		res = res ^ i
	if res == 0:
		return True
	for i in arr:
		y ^= i
		if y == res:
			y = 0
			l += 1
	return l >= 2
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print('YES' if xor(arr, n) else 'NO')


n = int(input())
while n != 0:
	le = int(input())
	lst = list(map(int, input().split()))
	x = 0
	for i in range(le):
		x = lst[i] ^ x
	(t, c) = (0, 0)
	for i in range(le):
		t ^= lst[i]
		if t == x:
			c += 1
			t = 0
	if c > 1 or x == 0:
		print('YES')
	else:
		print('NO')
	n -= 1


import sys, os
from difflib import SequenceMatcher
from collections import Counter
from bisect import bisect_left as bl, bisect_right as br
from io import BytesIO, IOBase
from itertools import accumulate
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def memoize(f):

	class memodict(dict):

		def __getitem__(self, *key):
			return dict.__getitem__(self, key)

		def __missing__(self, key):
			ret = self[key] = f(*key)
			return ret
	return memodict().__getitem__
LCSubstr = lambda a, b: SequenceMatcher(None, a, b).find_longest_match(0, len(a), 0, len(b))

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

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def extended_gcd(a, b):
	(s, old_s) = (0, 1)
	(r, old_r) = (b, a)
	while r:
		q = old_r // r
		(old_r, r) = (r, old_r - q * r)
		(old_s, s) = (s, old_s - q * s)
	return (old_r, old_s, (old_r - old_s * a) // b if b else 0)

def modinv(a, m):
	(g, x, _) = extended_gcd(a % m, m)
	return x % m if g == 1 else None

def make_nCr_mod(max_n=2 * 10 ** 5, mod=10 ** 9 + 7):
	max_n = min(max_n, mod - 1)
	(fact, inv_fact) = ([0] * (max_n + 1), [0] * (max_n + 1))
	fact[0] = 1
	for i in range(max_n):
		fact[i + 1] = fact[i] * (i + 1) % mod
	inv_fact[-1] = pow(fact[-1], mod - 2, mod)
	for i in reversed(range(max_n)):
		inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

	def nCr_mod(n, r):
		res = 1
		while n or r:
			(a, b) = (n % mod, r % mod)
			if a < b:
				return 0
			res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod
			n //= mod
			r //= mod
		return res
	return nCr_mod

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

def PrefixSum(arr):
	return list(accumulate(arr))

class inputs:

	def single(self):
		return int(input())

	def mul(self):
		return map(int, input().split())

	def list(self):
		return list(map(int, input().split()))
inp = inputs()

def main():
	for t in range(int(input())):
		n = inp.single()
		a = inp.list()
		if n == 2:
			if a[0] == a[1]:
				print('YES')
			else:
				print('NO')
			continue
		X = 0
		for i in range(0, len(a)):
			X = X ^ a[i]
		if X == 0:
			print('YES')
		else:
			z = []
			for i in a:
				if i != 0:
					z.append(i)
			a = z.copy()
			i = 0
			ans = 'NO'
			temp = a.copy()
			j = 0
			y = X
			c = [X]
			v = 0
			while j < len(temp):
				if temp[j] == y:
					c.append(y)
					v = 0
				else:
					v = v ^ temp[j]
					if v == y and c[-1] != y:
						c[-1] = v
						v = 0
					elif v == y:
						c.append(v)
						v = 0
					elif c[-1] == y:
						c.append(v)
					else:
						c[-1] = v
				j += 1
			z = []
			for i in c:
				if i != 0:
					z.append(i)
			c = z.copy()
			if len(set(c)) == 1 and len(c) > 2:
				ans = 'YES'
			print(ans)
main()


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	p = [0] * n
	p[0] = l[0]
	for i in range(1, n):
		p[i] = p[i - 1] ^ l[i]
	x = p[-1]
	f2 = 0
	for i in range(n - 1):
		x1 = p[i]
		x2 = p[-1] ^ x1
		if x1 == x2:
			f2 = 1
			break
	if f2 == 1:
		print('YES')
	else:
		f3 = 0
		for i in range(n - 2):
			x1 = p[i]
			for j in range(i + 1, n - 1):
				x2 = p[j] ^ x1
				x3 = p[-1] ^ p[j]
				if x1 == x2 and x2 == x3:
					f3 = 1
					break
			if f3:
				break
		if f3:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	for i in range(n):
		s = s ^ l[i]
	if s == 0:
		print('YES')
	else:
		cur = 0
		ct = 0
		for i in range(n):
			cur = cur ^ l[i]
			if cur == s:
				cur = 0
				ct += 1
		if cur == 0 and ct >= 2:
			print('YES')
		else:
			print('NO')


def check2(a):
	xo = 0
	for i in a:
		xo ^= i
	if xo == 0:
		return 1
	else:
		return 0

def check3(a):
	c = 0
	comp = 0
	for i in a:
		comp ^= i
	for i in range(1, len(a)):
		c ^= a[i - 1]
		now = comp ^ c
		d = 0
		for j in range(i, len(a)):
			d ^= a[j]
			if d == c and c == now ^ d:
				return 1
	return 0
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = check2(a)
	y = check3(a)
	if x or y:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
import functools
from operator import ixor
from decimal import Decimal
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	for i in range(n):
		k ^= a[i]
	if k == 0:
		print('YES')
	else:
		q = 0
		w = 0
		for i in range(n):
			q ^= a[i]
			if q == k:
				w += 1
				q = 0
		if q == 0 and w > 1:
			print('YES')
		else:
			print('NO')


import io, os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def solve_tc():
	n = int(input())
	s = [int(i) for i in input().split()]
	pre = [0 for i in range(n + 2)]
	for i in range(1, n + 1):
		pre[i] = pre[i - 1] ^ s[i - 1]
	yes = not pre[n]
	if yes:
		return 'YES'
	for i in range(1, n + 1):
		for j in range(i + 1, n):
			yes |= pre[i] == pre[j] ^ pre[i] and pre[i] == pre[n] ^ pre[j]
			if yes:
				return 'YES'
	return 'NO'
t = int(input())
while t > 0:
	t -= 1
	sys.stdout.write(solve_tc())
	sys.stdout.write('\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = a[0]
	for i in range(1, n):
		xor ^= a[i]
	if xor == 0:
		print('YES')
	else:
		currxor = 0
		totxor = xor
		cnt = 0
		for i in range(n):
			currxor ^= a[i]
			totxor ^= a[i]
			remxor = totxor ^ xor
			if currxor == xor and i != n - 1:
				cnt += 1
				if cnt > 1 and remxor == 0:
					break
				currxor = 0
		if currxor == xor and cnt > 0:
			print('YES')
		else:
			print('NO')


def solve(n, a):
	base = a[0]
	for i in range(1, n):
		base ^= a[i]
	if base == 0:
		return 'YES'
	c = 0
	xor = 0
	for x in a:
		xor ^= x
		if xor == base:
			c += 1
			xor = 0
	return 'YES' if c >= 2 else 'NO'
tt = int(input())
while tt > 0:
	tt -= 1
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ff = 0
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x ^= arr[j]
		f = 0
		t = 0
		for j in range(i + 1, n):
			t ^= arr[j]
			if t == x:
				f = 1
				t = 0
		if t == 0 and f:
			print('YES')
			ff = 1
			break
	if not ff:
		print('NO')


from sys import *

def value_of_arr(a):
	result = 0
	for x in a:
		result = x ^ result
	return result

def is_good_arr(a, value):
	for x in a:
		if x != value:
			return False

def check_arr_empty(a, value):
	left_value = 0
	for i in range(0, len(a) - 1):
		x = a[i]
		left_value = left_value ^ x
		if left_value == value:
			return True
	return False

def solve_case(t):
	n = int(stdin.readline())
	a = [int(x) for x in stdin.readline().rstrip().split()]
	has_pass = False
	all_value = value_of_arr(a)
	if all_value == 0:
		has_pass = len(a) > 1
	else:
		left_value = 0
		for i in range(0, len(a) - 1):
			x = a[i]
			left_value = left_value ^ x
			if left_value == all_value:
				has_pass = check_arr_empty(a[i + 1:], all_value)
				if has_pass:
					break
	if has_pass:
		print('YES')
	else:
		print('NO')

def main():
	T = int(stdin.readline())
	for t in range(T):
		solve_case(t)
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	prev = [arr[0]]
	for i in arr[1:]:
		prev.append(prev[-1] ^ i)
	if prev[-1] == 0:
		print('YES')
	else:
		flag = False
		for i in range(n):
			if prev[-1] ^ prev[i] == 0:
				for j in range(i + 1, n):
					if prev[j] == 0:
						flag = True
						break
			if flag:
				break
		if flag:
			print('YES')
		else:
			print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ar = a[::-1]
	(t, t2) = (0, 0)
	d = defaultdict(int)
	(pre, suff) = ([], [])
	for x in ar:
		t2 ^= x
		suff.append(t2)
	suff.reverse()
	p = 0
	f = 0
	t = t2
	for i in range(n - 1):
		p ^= a[i]
		if t ^ p == p:
			f = 1
			break
		if p == 0 and d[suff[i + 1]] == 1:
			f = 1
			break
		d[p] = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	ans = 0
	flag = False
	for (i, j) in enumerate(nums):
		ans ^= j
		if i != n - 1 and ans == 0:
			flag = True
	if ans:
		temp = 0
		cnt = 0
		for i in nums:
			temp ^= i
			if temp == ans:
				temp = 0
				cnt += 1
		print('YES' if cnt > 1 else 'NO')
	elif flag:
		print('YES')
	else:
		(left, right) = ([], [])
		ans = 0
		for i in nums:
			ans ^= i
			left.append(ans)
		for i in reversed(nums):
			ans ^= i
			right.append(ans)
		right = list(reversed(right))
		for i in range(n - 1):
			if left[i] == right[i + 1]:
				print('YES')
				break
		else:
			print('NO')


def ass(l, n, axor):
	ans = 0
	for i in range(n - 1):
		ans ^= l[i]
		xor = ans ^ axor
		if ans == xor:
			return True
		elif xor == 0:
			flag = 0
			for j in range(i + 1, n):
				if ans == xor:
					return True
				xor ^= l[j]
	return False
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	assxor = 0
	for i in l:
		assxor ^= i
	print('YES' if ass(l, n, assxor) else 'NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt, log2
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

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

def modInverse(b):
	g = gcd(b, mod)
	if g != 1:
		return -1
	else:
		return pow(b, mod - 2, mod)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	n = int(inp())
	a = lis()
	suff = [0] * (n + 1)
	for i in range(n - 1, -1, -1):
		suff[i] = suff[i + 1] ^ a[i]
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x ^= a[j]
		f = True
		for j in range(i + 1, n):
			if suff[j] == x and f:
				print('YES')
				return
			if a[j] != x:
				f = False
		if suff[i + 1] == 0 and x != 0 and (x in suff[i + 1:n]):
			print('YES')
			return
	print('NO')
testcase(int(inp()))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	xor_arr = 0
	for ele in a:
		xor_arr = xor_arr ^ ele
	if xor_arr == 0:
		print('YES')
	else:
		count = 0
		xor = 0
		for ele in a:
			xor = xor ^ ele
			if xor == xor_arr:
				count += 1
				xor = 0
		if count >= 2 and xor == 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	for x in arr:
		a ^= x
	c = 0
	cnt = 0
	for x in arr:
		c ^= x
		if c == a:
			cnt += 1
			c = 0
	if a == 0 or cnt > 2:
		print('YES')
	else:
		print('NO')


from functools import reduce

def xor(array):
	return reduce(lambda x, y: x ^ y, array, 0)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	total_xor = xor(a)
	if total_xor == 0:
		print('YES')
	else:
		cumulative_xor = 0
		pieces = 0
		for element in a:
			cumulative_xor ^= element
			if cumulative_xor == total_xor:
				cumulative_xor = 0
				pieces += 1
		if pieces >= 3:
			print('YES')
		else:
			print('NO')


from functools import reduce

def d3(a, n):
	pre = [0] * n
	pre[0] = a[0]
	for i in range(1, n):
		pre[i] = a[i] ^ pre[i - 1]
	for i in range(n):
		for j in range(i + 1, n):
			if pre[i] == pre[j] ^ pre[i] and pre[n - 1] ^ pre[j] == pre[i]:
				return True
	return False
for _ in [0] * int(input()):
	n = int(input())
	a = list(map(int, input().split()))
	d2 = reduce(lambda x, y: x ^ y, a)
	if d2 == 0:
		print('YES')
	else:
		print(['NO', 'YES'][d3(a, n)])


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		pre = [a[0]]
		for i in range(1, n):
			pre.append(pre[i - 1] ^ a[i])
		f = 0
		for i in range(n - 1):
			if pre[i] == pre[-1] ^ pre[i]:
				f = 1
		for i in range(0, n):
			for j in range(i + 1, n):
				if pre[i] == pre[j] ^ pre[i] == pre[-1] ^ pre[j]:
					f = 1
		if f:
			print('YES')
		else:
			print('NO')
	return
main()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter

def solve():
	input()
	a = list(map(int, input().split()))
	t = 0
	for i in a:
		t ^= i
	if not t:
		return 'YES'
	(z, y) = (0, 0)
	for i in a:
		z ^= i
		if z == t:
			y += 1
			z = 0
	if y > 1:
		return 'YES'
	return 'NO'

def main():
	for _ in range(int(input())):
		print(solve())
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math

def input():
	return sys.stdin.readline().strip('\n')

def I():
	return input()

def II():
	return int(input())

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

def LI():
	return list(map(int, input().split()))
for _ in range(II()):
	n = II()
	a = LI()
	switch = 0
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x ^= a[j]
		flag = 0
		t = 0
		for j in range(i + 1, n):
			t ^= a[j]
			if t == x:
				flag = 1
				t = 0
		if t == 0 and flag == 1:
			print('YES')
			switch = 1
			break
	if switch == 0:
		print('NO')


Test = int(input())
for T in range(Test):
	N = int(input())
	Data = list(map(int, input().split()))
	(Even, Odd) = (0, 0)
	for i in range(N):
		Even = Even ^ Data[i]
	if Even == 0:
		print('YES')
	else:
		Counter = 0
		for i in range(N):
			Odd = Odd ^ Data[i]
			if Odd == Even:
				Counter += 1
				Odd = 0
		if Counter >= 3:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	count = 0
	for i in range(n):
		x = x ^ l[i]
	if x == 0:
		print('YES')
	else:
		i = 0
		count = 0
		while i < n - 1:
			if l[i] == x:
				i += 1
				count += 1
			else:
				p = l[i] ^ l[i + 1]
				l[i] = 0
				l[i + 1] = p
				i += 1
		q = list(set(l))
		q.sort()
		if len(q) > 2:
			print('NO')
		elif count < 2:
			print('NO')
		elif len(q) == 2:
			if q[0] == 0 and q[1] == x:
				print('YES')
			else:
				print('NO')
		elif q[0] == x:
			print('YES')
		else:
			print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	summ = 0
	for ele in arr:
		summ ^= ele
	if summ == 0:
		print('YES')
	else:
		cnt = 0
		summ2 = 0
		for ele in arr:
			summ2 ^= ele
			if summ2 == summ:
				cnt += 1
				summ2 = 0
		if cnt >= 2:
			print('YES')
		else:
			print('NO')


def solve():
	n = int(input())
	v = [int(e) for e in input().split()]
	(x, y, c) = (0, 0, 0)
	for i in range(0, n):
		x ^= v[i]
	for i in range(n - 1, -1, -1):
		y ^= v[i]
		if y == x:
			c += 1
			y = 0
	if not x or c > 1:
		return 'YES'
	return 'NO'

def init():
	T = 1
	T = int(input())
	while T:
		print(solve())
		T -= 1
init()


t = int(input())
for q in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor ^= arr[i]
	if xor == 0:
		print('YES')
	else:
		cnt = 0
		xr = 0
		for i in range(n):
			xr ^= arr[i]
			if xor == xr:
				cnt += 1
				xr = 0
		if cnt >= 2:
			print('YES')
		else:
			print('NO')


def xor(a):
	ans = 0
	for i in a:
		ans ^= i
	return ans

def main(a, n):
	b = xor(a)
	if b == 0:
		print('YES')
		return ''
	else:
		main = 0
		ct = 0
		for i in a:
			main ^= i
			if main == b:
				ct += 1
				main = 0
			if ct > 1:
				print('YES')
				return ''
	print('NO')
	return ''
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	main(a, n)


def test(N, A):
	x = 0
	xL = [x]
	for a in A:
		x = x ^ a
		xL.append(x)
	if x == 0:
		return 'YES'
	b = False
	for i in range(1, N):
		x1 = xL[i]
		if x1 == x:
			for j in range(i + 1, N):
				x2 = x1 ^ xL[j]
				if x2 == x:
					b = True
					break
	if b:
		return 'YES'
	else:
		return 'NO'
	return xL
for kT in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	print(test(N, A))


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	V = 0
	for i in range(n):
		V ^= arr[i]
	if V > 0:
		curr = cnt = 0
		for i in range(n):
			curr ^= arr[i]
			if curr == V:
				cnt += 1
				curr = 0
		return 'YES' if cnt % 2 and cnt > 2 else 'NO'
	else:
		return 'YES'
for _ in range(int(input())):
	print(solve())


import sys
import math
from collections import defaultdict as dd
from sys import stdin
input = stdin.readline
m = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 5)
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	t1 = 0
	f = 0
	for i in range(n - 1):
		t1 ^= arr[i]
		t2 = -1
		c = 0
		for j in range(i + 1, n):
			if t1 == t2:
				t2 = arr[j]
				c += 1
				continue
			if t2 == -1:
				t2 = arr[j]
			else:
				t2 ^= arr[j]
		if t1 == t2 or (c and t2 == 0):
			f = 1
			break
	if f:
		print('YES')
	else:
		print('NO')


def sol(n, A):
	xorlisty = A[0]
	for i in range(1, n):
		xorlisty ^= A[i]
	if xorlisty == 0:
		return 'YES'
	lewa = A[0]
	for i in range(1, n):
		prawa = A[i]
		for j in range(i + 1, n):
			if lewa == prawa == xorlisty:
				return 'YES'
			prawa ^= A[j]
		lewa ^= A[i]
	return 'NO'

def main():
	for i in range(int(input())):
		n = int(input())
		print(sol(n, list(map(int, input().split()))))
main()


t = int(input())
for i in range(t):
	n = int(input())
	total = 0
	inp = list(map(int, input().split()))
	q = [0]
	for i in range(n):
		total = total ^ inp[i]
		q.append(total)
	suc = 0
	suc2 = 0
	for i in range(n):
		if total == q[i]:
			suc2 = 1
		if q[i] == 0 and suc2 == 1:
			suc = 1
	if suc:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	arr = [int(x) for x in input().split()]
	xor = 0
	for item in arr:
		xor ^= item
	if not xor:
		print('YES')
	else:
		cnt = 0
		tmp = 0
		for item in arr:
			tmp ^= item
			if tmp == xor:
				tmp = 0
				cnt += 1
		if cnt > 1:
			print('YES')
		else:
			print('NO')


import os, sys
from io import BytesIO, IOBase
from collections import deque, Counter, defaultdict as dft
from heapq import heappop, heappush
from math import log, sqrt, factorial, cos, tan, sin, radians, log2, ceil, floor
from bisect import bisect, bisect_left, bisect_right
from decimal import *
import sys, threading
from itertools import permutations, combinations
from copy import deepcopy
input = sys.stdin.readline
ii = lambda : int(input())
si = lambda : input().rstrip()
mp = lambda : map(int, input().split())
ms = lambda : map(str, input().strip().split(' '))
ml = lambda : list(mp())
mf = lambda : map(float, input().split())
alphs = 'abcdefghijklmnopqrstuvwxyz'

def solve():
	n = ii()
	arr = ml()
	pre = []
	num = 0
	for k in arr:
		num = num ^ k
		pre.append(num)
	if num == 0:
		print('YES')
	else:
		for i in range(1, n - 1):
			for j in range(i, n - 1):
				t1 = pre[i - 1]
				t2 = pre[j] ^ t1
				t3 = pre[-1] ^ pre[j]
				if t1 == t2 == t3:
					print('YES')
					return
		print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
tc = 1
tc = ii()
for i in range(tc):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	x = 0
	for i in a:
		x = x ^ i
	if x == 0:
		print('YES')
	else:
		arr = [0 for i in range(31)]
		y = 0
		f = 0
		for i in range(n):
			y = y ^ a[i]
			if y == x:
				f += 1
				y = 0
		if f < 3:
			print('NO')
		else:
			print('YES')


from sys import stdin, stdout
get_string = lambda : stdin.readline().strip(' ')
get_intmap = lambda : map(int, get_string().split(' '))

def testcase():
	n = int(input())
	l = list(get_intmap())
	(dp_left, dp_right) = ([0] * n, [0] * n)
	(dp_left[0], dp_right[-1]) = (l[0], l[-1])
	for ind in range(1, n):
		dp_left[ind] = dp_left[ind - 1] ^ l[ind]
	for ind in range(n - 2, -1, -1):
		dp_right[ind] = dp_right[ind + 1] ^ l[ind]
	for ind in range(n - 1):
		if dp_left[ind] == dp_right[ind + 1]:
			print('YES')
			return
	all_xor = dp_left[-1]
	(dp_left_indices, dp_right_indices) = ([], [])
	for (ind, val) in enumerate(dp_left):
		if val == all_xor:
			dp_left_indices.append(ind)
	for (ind, val) in enumerate(dp_right):
		if val == all_xor:
			dp_right_indices.append(ind)
	for ind1 in dp_left_indices:
		for ind2 in dp_right_indices:
			if ind2 > ind1 + 1:
				print('YES')
				return
	print('NO')
t = min(10 ** 9, int(input()))
for t in range(t):
	testcase()


import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	res = b[0]
	j = 1
	while j < n:
		res ^= b[j]
		j += 1
	if res != 0:
		i = -1
		j = -1
		curr = 0
		req = 0
		while curr < n:
			req ^= b[curr]
			if req == res:
				i = curr
				break
			curr += 1
		req = 0
		curr = n - 1
		while curr >= 0:
			req ^= b[curr]
			if req == res:
				j = curr
				break
			curr += -1
		if i != -1 and j != -1 and (i < j):
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag = False
	ff = 0
	for i in range(n - 1):
		b = 0
		for k in range(0, i + 1):
			b = b ^ l[k]
		flag = False
		a = 0
		for j in range(i + 1, n):
			a = a ^ l[j]
			if a == b:
				flag = True
				a = 0
		if a == 0 and flag == True:
			print('YES')
			ff = 1
			break
	if ff != 1:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	entrada = input()
	array = [int(x) for x in entrada.split(' ')]
	ans = 0
	for i in range(n):
		ans = ans ^ array[i]
	if ans == 0:
		print('YES')
	else:
		temp = 0
		count = 0
		for i in range(n):
			temp = temp ^ array[i]
			if temp == ans:
				count += 1
				temp = 0
		if temp == 0 and count > 1:
			print('YES')
		else:
			print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = 0
	for i in range(n):
		d ^= a[i]
	if d == 0:
		print('YES')
	else:
		(s, xor) = (0, 0)
		for i in range(n):
			xor ^= a[i]
			if xor == d:
				s += 1
				xor = 0
		if s >= 3:
			print('YES')
		else:
			print('NO')


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	xor = 0
	for i in a:
		xor ^= i
	flag = 0
	now = 0
	for i in range(n):
		now ^= a[i]
		curr = 0
		for j in range(n - 1, i, -1):
			curr ^= a[j]
			rem = xor ^ curr ^ now
			if now == curr == rem:
				flag = 1
				break
		if now == curr:
			flag = 1
		if flag:
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	line = input()
	nums = line.split(' ')
	last = 0
	for j in range(0, n):
		last = last ^ int(nums[j])
	if last == 0:
		print('YES')
		continue
	xor = last
	last = 0
	count = 0
	for i in range(0, n):
		last ^= int(nums[i])
		if last == xor:
			count += 1
			last = 0
	if count >= 3:
		print('YES')
		continue
	print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	k = 0
	cnt = 0
	for i in range(n):
		s = s ^ l[i]
	if s == 0:
		print('YES')
	else:
		for i in range(n):
			k = k ^ l[i]
			if k == s:
				cnt += 1
				k = 0
		if cnt >= 3:
			print('YES')
		else:
			print('NO')


import sys
import os.path
if os.path.exists('input_file.txt'):
	sys.stdin = open('input_file.txt', 'r')
	sys.stdout = open('output_file.txt', 'w')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	aa = []
	ans = 0
	comp = a[0]
	f = 0
	for i in range(n):
		if a[i] != comp:
			f = 1
			break
	if f:
		for i in range(n):
			ans ^= a[i]
		if ans != 0:
			anss = 0
			f = 0
			for i in range(n):
				anss ^= a[i]
				if anss == ans:
					anss = 0
					f += 1
			if anss == 0:
				if f >= 2:
					ans = 0
		if ans == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor ^= a[i]
	if xor == 0:
		print('YES')
	else:
		nx = 0
		c = 0
		for i in range(n):
			nx ^= a[i]
			if nx == xor:
				c += 1
				nx = 0
		if c >= 2:
			print('YES')
		else:
			print('NO')


def xorOfArray(arr, n):
	xor_arr = 0
	for i in range(n):
		xor_arr = xor_arr ^ arr[i]
	return xor_arr
ram = int(input())
for cidk in range(ram):
	a = int(input())
	l = list(map(int, input().split()))
	w = 0
	x = xorOfArray(l, a)
	if x == 0:
		print('YES')
		w = -1
	if w == 0:
		x = xorOfArray(l, a)
		y = 0
		z = x
		q = 0
		r = 0
		for i in range(1, a):
			y = y ^ l[i - 1]
			z = z ^ l[i - 1]
			if y == 0 and z == x:
				q = 1
				s = i
			if y == x and z == 0:
				r = 1
				t = i
			if q == 1 and r == 1 and (s > t):
				print('YES')
				w = -2
				break
	if w == 0:
		print('NO')


from sys import stdin as inp
from functools import reduce
for t in range(int(inp.readline())):
	n = list(map(int, inp.readline().split()))
	arr = list(map(int, inp.readline().split()))
	count = 0
	y = 0
	check = reduce(lambda x, y: x ^ y, arr)
	for x in arr:
		y ^= x
		if y == check:
			count += 1
			y = 0
	print('YES') if count > 1 or check == 0 else print('NO')


def ans(l, n):
	(xr, x) = (0, 0)
	for i in range(n):
		xr ^= l[i]
	if xr == 0:
		return 'YES'
	for i in range(n):
		x ^= l[i]
		c = 0
		if x == xr:
			for j in range(i + 1, n - 1):
				c ^= l[j]
				if c == x:
					return 'YES'
	return 'NO'
tc = int(input())
for _ in range(tc):
	n = int(input())
	l = list(map(int, input().split()))
	print(ans(l, n))


import sys
import math
LI = lambda : [int(k) for k in input().split()]
input = lambda : sys.stdin.readline().rstrip()
IN = lambda : int(input())
S = lambda : input()
for t in range(IN()):
	n = IN()
	a = LI()
	pre = 0
	for i in range(n):
		pre ^= a[i]
		prea = 0
		flag = 0
		for j in range(i + 1, n):
			prea ^= a[j]
			if prea == pre:
				prea = 0
				flag = 1
		if flag and (not prea):
			print('YES')
			break
	if not flag:
		print('NO')


def solve(a, n, xor):
	res = 0
	for i in range(n - 1):
		res ^= a[i]
		x = res ^ xor
		if res == x:
			return True
		elif x == 0:
			bel = 0
			for j in range(i + 1, n):
				if res == x:
					return True
				x ^= a[j]
	return False
test = int(input())
for _ in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	result = 0
	for i in a:
		result ^= i
	if solve(a, n, result):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
for xyz in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	xr = 0
	for i in l:
		xr = xr ^ i
	if xr:
		fxr = xr
		cxr = 0
		cnt = 0
		for i in range(0, n):
			cxr = cxr ^ l[i]
			if cxr == fxr:
				cnt += 1
				cxr = 0
		if cnt % 2 and cnt > 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


def solve() -> bool:
	n = int(input())
	array = list(map(int, input().split()))
	s = 0
	for e in array:
		s ^= e
	if s == 0:
		return True
	current = 0
	counter = 0
	for e in array:
		current ^= e
		if current == s:
			counter += 1
			current = 0
	if counter > 2:
		return True
	return False
for _ in range(int(input())):
	print('YES' if solve() else 'NO')


DEBUG = False
if DEBUG:
	input = open('input.txt', 'r').readline
t = int(input())
for ignore in range(0, t):
	n = int(input())
	a = [*map(int, input().split())]
	prec = ans = count = 0
	for i in a:
		prec ^= i
	for i in a:
		ans ^= i
		if ans == prec:
			count += 1
			ans = 0
	if count > 1 or prec < 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('YES')
		continue
	rev = a[::-1]
	current = rev[0]
	check_list = [current]
	for x in rev[1:]:
		current ^= x
		check_list.append(current)
	check_list = check_list[::-1][1:]
	current = 0
	finished = False
	for (i, x) in enumerate(a[:-1]):
		current ^= x
		if check_list[i] == current:
			print('YES')
			finished = True
			break
	if finished:
		continue
	if n < 3:
		print('NO')
		continue
	c1 = 0
	c2 = 0
	rest = 0
	for x in a:
		rest ^= x
	for i in range(n - 2):
		c1 ^= a[i]
		c2 = 0
		rest ^= a[i]
		c3 = rest + 0
		for j in range(i + 1, n - 1):
			c2 ^= a[j]
			c3 ^= a[j]
			if c1 == c2 == c3:
				print('YES')
				finished = True
				break
		if finished:
			break
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(xor, count, xorr) = (0, 0, 0)
	for i in range(n):
		xor = xor ^ a[i]
	if xor == 0:
		print('YES')
	else:
		for i in range(n):
			xorr = xorr ^ a[i]
			if xor == xorr:
				count += 1
				xorr = 0
		if count >= 2:
			print('YES')
		else:
			print('NO')


def solve():
	t = inp()
	for _ in range(t):
		n = inp()
		l = seq()
		result = 0
		for j in range(n):
			result = result ^ l[j]
		if result == 0:
			carry = 0
			flag = 0
			for j in range(n - 1):
				carry = carry ^ l[j]
				if carry == result ^ carry:
					print('YES')
					flag = 1
					break
			if flag == 0:
				print('NO')
		else:
			val = 0
			count = 0
			segment = 0
			for j in range(n):
				val = val ^ l[j]
				count += 1
				if val == result:
					count = 0
					val = 0
					segment += 1
			if segment >= 2 and val == 0:
				print('YES')
			else:
				print('NO')
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
solve()


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	ok = False
	pre = 0
	for i in range(n):
		pre = pre ^ A[i]
	if pre == 0:
		print('YES')
	else:
		t = 0
		c = 0
		for i in range(n):
			t = t ^ A[i]
			if t == pre:
				t = 0
				c += 1
		if c > 2:
			print('YES')
		else:
			print('NO')


def helper(a):
	xsum = 0
	for i in range(len(a)):
		xsum ^= a[i]
	if xsum == 0:
		return 'YES'
	t3 = xsum
	l = -1
	tl = 0
	r = len(a)
	tr = 0
	while l < len(a) - 1:
		l += 1
		tl ^= a[l]
		if tl == t3:
			break
	while r > 0:
		r -= 1
		tr ^= a[r]
		if tr == t3:
			break
	if l < r:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	res = helper(a)
	print(res)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		lst = list(map(int, input().split()))
		curr = 0
		for ele in lst:
			curr ^= ele
		if curr == 0:
			yield 'YES'
		else:
			counter = 0
			currC = 0
			for ele in lst:
				currC ^= ele
				if currC == curr:
					counter += 1
					currC = 0
			if counter > 1 and currC == 0:
				yield 'YES'
			else:
				yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


def AGAGA_XOOORRR(size, ar):
	xor = 0
	for i in range(size):
		xor ^= ar[i]
	if xor == 0:
		print('YES')
	else:
		(count, xr) = (0, 0)
		for i in range(size):
			xr ^= ar[i]
			if xor == xr:
				count += 1
				xr = 0
		print('YES') if count >= 2 else print('NO')
T = int(input())
for _ in range(T):
	n = int(input())
	array = list(map(int, input().split()))
	AGAGA_XOOORRR(n, array)


import sys

def solve(n, a):
	b = a[:]
	for i in range(1, n):
		b[i] ^= b[i - 1]

	def X(i, j):
		if i == 0:
			return b[j]
		return b[j] ^ b[i - 1]
	seen = set()
	for i in range(n - 1):
		cur = b[i]
		x = X(i + 1, n - 1)
		if cur == x:
			return 'YES'
		if x in seen and cur ^ x == x:
			return 'YES'
		seen.add(cur)
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


import functools
reduce = functools.reduce
tests = int(input())
for case in range(tests):
	n = int(input())
	a = [int(i) for i in input().split()]
	he = reduce(lambda x, y: x ^ y, a)
	if he == 0:
		print('YES')
	else:
		sm = 0
		flag = 0
		for i in a:
			sm ^= i
			if sm == he:
				flag += 1
				sm = 0
		if flag >= 3:
			print('YES')
		else:
			print('NO')


def solve(arr):
	ans = 0
	for a in arr:
		ans ^= a
	if ans == 0:
		print('YES')
		return
	s = 0
	cnt = 0
	for a in arr:
		s ^= a
		if s == ans:
			s = 0
			cnt += 1
	if s == 0 and cnt > 1:
		print('YES')
		return
	print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	solve(arr)


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	s = 0
	for j in range(n):
		a[j] = int(a[j])
		s = s ^ a[j]
	if s == 0:
		print('YES')
	else:
		s1 = 0
		count = 0
		for j in range(n):
			s1 = s1 ^ a[j]
			if s1 == s:
				count += 1
				s1 = 0
		if count > 1:
			print('YES')
		else:
			print('NO')


import sys
from collections import defaultdict
input = sys.stdin.readline

def solve(n):
	arr = list(map(int, input().split()))
	dp = defaultdict(int)
	for i in range(n):
		dp[i] = dp[i - 1] ^ arr[i]
	temp = 0
	if dp[n - 1] == 0:
		for i in range(n - 1):
			if dp[i] == dp[n - 1] ^ dp[i]:
				temp = 1
		if temp:
			print('YES')
		else:
			print('NO')
	else:
		temp = 0
		for i in range(n - 2):
			if dp[i] == dp[n - 1]:
				for j in range(i + 1, n - 1):
					if dp[j] == 0:
						temp = 1
						break
		if temp:
			print('YES')
		else:
			print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


from collections import Counter

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	l.insert(0, 0)
	p = [0] * (n + 1)
	for i in range(1, n + 1):
		p[i] = p[i - 1] ^ l[i]
	for i in range(1, n + 1):
		if p[i] == p[n] ^ p[i]:
			print('YES')
			return
	for i in range(1, n + 1):
		for j in range(i + 2, n + 1):
			if p[i] == p[n] ^ p[j - 1] and p[i] == p[j - 1] ^ p[i]:
				print('YES')
				return
	print('NO')
for testis in range(int(input())):
	solve()


from sys import stdin, stdout
stdin.readline

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

def it():
	return int(stdin.readline().strip())
from collections import defaultdict as dd, Counter as C, deque
from math import ceil, gcd, sqrt, factorial, log2, floor
for _ in range(it()):
	n = it()
	l = mp()
	x = 0
	for i in range(n):
		x = x ^ l[i]
	if x == 0:
		print('YES')
		continue
	x = 0
	ans = 'NO'
	for i in range(n - 1):
		x ^= l[i]
		flag = 0
		y = 0
		for j in range(i + 1, n):
			y ^= l[j]
			if y == x:
				flag = 1
				y = 0
		if not y and flag:
			ans = 'YES'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x = x ^ a[j]
		f1 = 0
		t = 0
		for j in range(i + 1, n):
			t = t ^ a[j]
			if t == x:
				f1 = 1
				t = 0
		if t == 0 and f1:
			c = 1
			break
	if c == 1:
		print('YES')
	if c == 0:
		print('NO')


from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
input = stdin.readline
prin = stdout.write
from random import sample
from collections import Counter, deque
from fractions import *
from math import sqrt, ceil, log2, gcd, cos, pi
mod = 10 ** 9 + 7
mod2 = 998244353

def ps(n):
	cp = 0
	lk = 0
	arr = {}
	lk = 0
	ap = n
	cc = 0
	while n % 2 == 0:
		n = n // 2
		cc = 1
	if cc == 1:
		lk += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		cc = 0
		while n % ps == 0:
			n = n // ps
			cc = 1
		lk += 1 if cc == 1 else 0
	if n != 1:
		lk += 1
	if lk == 1:
		return [False, 0]
	return [True, lk]

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

def factorials(n, r):
	slr = n
	dpr = r
	qlr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(n - r + 1, n + 1):
		qlr = qlr * ip % mod
	for ij in range(1, r + 1):
		qs = qs * ij % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def power(arr):
	listrep = arr
	subsets = []
	for i in range(2 ** len(listrep)):
		subset = []
		for k in range(len(listrep)):
			if i & 1 << k:
				subset.append(listrep[k])
		subsets.append(subset)
	return subsets

def pda(n):
	list = []
	su = 0
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				list.append(i)
				su += i
			else:
				list.append(n // i)
				list.append(i)
				su += i
				su += n // i
	return su

def dis(xa, ya, xb, yb):
	return sqrt((xa - xb) ** 2 + (ya - yb) ** 2)

def ii():
	return int(input())

def ilist():
	return [int(x) for x in input().strip().split()]

def islist():
	return list(map(str, input().split().rstrip()))

def inp():
	return input().strip()

def google(test, ans):
	return 'Case #' + str(test) + ': ' + str(ans)

def overlap(x1, y1, x2, y2):
	if x2 > y1:
		return y1 - x2
	if y1 > y2:
		return y2 - x2
	return y1 - x2

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

def sieve(n):
	ans = [i + 1 for i in range(n + 1)]
	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
				ans[i] += p
				if i // p != p:
					ans[i] += i // p
		p += 1
	ans[0] = 0
	ans[1] = 1
	dicts = {}
	for j in range(n + 1):
		dicts[ans[j]] = j
	return dicts

def prod(arr):
	n = len(arr)
	k = 1
	for j in range(n):
		k *= arr[j]
	return k
t = int(input())
for p in range(t):
	n = ii()
	arr = ilist()
	kk = arr[0]
	for i in range(1, n):
		kk ^= arr[i]
	if kk == 0:
		print('YES')
	else:
		prev = 0
		cou = 0
		for i in range(n):
			prev ^= arr[i]
			if prev == kk:
				cou += 1
				prev = 0
		if cou > 1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor ^= ar[i]
	if xor == 0:
		print('YES')
		continue
	else:
		(cnt, temp) = (0, 0)
		for i in range(n):
			temp = temp ^ ar[i]
			if temp == xor:
				cnt += 1
				temp = 0
		if cnt >= 2:
			print('YES')
		else:
			print('NO')


from itertools import accumulate
tests = int(input())
for t in range(tests):
	n = int(input())
	arr = map(int, input().split(' '))
	pref = list(accumulate(arr, lambda a, b: a ^ b))
	if pref[-1] == 0:
		print('YES')
	elif pref[-1] in pref[:n - 1] and 0 in pref[pref[:n - 1].index(pref[-1]):]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	for i in range(n):
		x = x ^ a[i]
	if x == 0:
		print('YES')
	else:
		(c, z) = (0, 0)
		for i in range(n):
			z = z ^ a[i]
			if z == x:
				c = c + 1
				z = 0
		if c >= 3:
			print('YES')
		else:
			print('NO')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s.rstrip())

def invr():
	return map(int, input().split())
t = inp()
for f in range(t):
	n = inp()
	L = inlt()
	s = 0
	for l in L:
		s ^= l
	if s == 0:
		print('YES')
	else:
		a = 0
		c = 0
		for l in L:
			if a == s:
				a = 0
				c += 1
			a ^= l
		if c > 1:
			print('YES')
		else:
			print('NO')


import functools, operator, sys

def f(t, z):
	for x in t:
		z ^= x
		if not z:
			yield from t
	yield from ()
for l in sys.stdin.readlines()[2::2]:
	a = [int(x) for x in l.split()]
	z = functools.reduce(operator.xor, a)
	t = iter(a)
	if z:
		t = f(t, z)
		t = f(t, z)
		print('YES' if next(t, None) is not None else 'NO')
	else:
		print('YES')


def fun(ls, n):
	if n == 2:
		if ls[0] == ls[1]:
			print('YES')
		else:
			print('NO')
	else:
		prefix_xor = []
		for i in ls:
			if prefix_xor == []:
				prefix_xor.append(i)
			else:
				prefix_xor.append(i ^ prefix_xor[-1])
		array_of_two = False
		array_of_three = False
		last_xor = prefix_xor[-1]
		for i in range(n - 1):
			if prefix_xor[i] == last_xor ^ prefix_xor[i]:
				array_of_two = True
				break
		for i in range(n - 2):
			for j in range(i + 1, n - 1):
				if prefix_xor[i] == prefix_xor[j] ^ prefix_xor[i] and prefix_xor[j] ^ prefix_xor[i] == last_xor ^ prefix_xor[j]:
					array_of_three = True
					break
		if array_of_two or array_of_three:
			print('YES')
		else:
			print('NO')
T = int(input())
for _ in range(T):
	n = int(input())
	ls = list(map(int, input().split()))
	fun(ls, n)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	for i in l:
		x ^= i
	if not x:
		print('YES')
	else:
		t = x
		x = 0
		c = 0
		for i in l:
			x ^= i
			if x == t:
				x = 0
				c += 1
		print('YES' if c >= 3 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	if l.count(l[0]) == n:
		print('YES')
		continue
	for i in l:
		ans = ans ^ i
	if ans == 0:
		print('YES')
	else:
		c = 0
		k = 0
		for i in l:
			k = k ^ i
			if k == ans:
				c += 1
				k = 0
		if c >= 2:
			print('YES')
		else:
			print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('YES')
		continue
	boo = False
	for i in range(n - 1):
		x = 0
		for j in range(i + 1):
			x ^= a[j]
		t = 0
		f = 0
		for j in range(i + 1, n):
			t ^= a[j]
			if t == x:
				f = 1
				t = 0
		if f == 1 and t == 0:
			print('YES')
			boo = True
			break
	if boo:
		continue
	print('NO')


import math as mt

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

def getInt():
	return int(getInput())

def getInts():
	return map(int, getInput().split())

def getArray():
	return list(getInts())

def solve(li, n):
	xor = 0
	for i in li:
		xor ^= i
	if xor == 0:
		print('YES')
		return
	pre = li[0]
	for i in range(1, n):
		mid = li[i]
		for j in range(i + 1, n):
			if pre == mid and mid == xor:
				print('YES')
				return
			mid ^= li[j]
		pre ^= li[i]
	print('NO')
for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	solve(li, n)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	count = 0
	x = 0
	for i in arr:
		x ^= i
	if x == 0:
		print('YES')
		return
	nx = 0
	for i in arr:
		nx ^= i
		if nx == x:
			count += 1
			nx = 0
	if count >= 3:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	while t:
		solve()
		t -= 1
main()


def solve(arr, n):
	if n == 2:
		if arr[0] == arr[-1]:
			return 'YES'
		else:
			return 'NO'
	x = 0
	for it in arr:
		x ^= it
	if x == 0:
		pref = 0
		for it in arr[:-1]:
			pref ^= it
			if pref == x ^ pref:
				return 'YES'
		return 'NO'
	count = 0
	cur = 0
	for it in arr:
		cur ^= it
		if cur == x:
			count += 1
			cur = 0
	if count > 1 and cur == 0:
		return 'YES'
	else:
		return 'NO'
for case in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = solve(arr, n)
	print(ans)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	pre = []
	pos = [-1]
	x = 0
	for i in lst:
		x = x ^ i
		pre.append(x)
	x = 0
	for i in lst[::-1]:
		x = x ^ i
		pos.append(x)
	pos = pos[::-1]
	pos = pos[1:]
	flag = True
	for i in range(n):
		if pre[i] == pos[i]:
			print('YES')
			flag = False
			break
		elif pre[i] == 0:
			z = pos[i]
			if z in pre[:i + 1]:
				print('YES')
				flag = False
				break
		elif pos[i] == 0:
			z = pre[i]
			if z in pos[i:]:
				print('YES')
				flag = False
				break
	if flag:
		print('NO')


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
m = 10 ** 9 + 7
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	ch = 0
	for i in arr:
		ch ^= i
	if ch == 0:
		print('YES')
	else:
		ch1 = 0
		c = 0
		for i in arr:
			ch1 ^= i
			if ch1 == ch:
				c += 1
				ch1 = 0
		if c >= 2 and ch == ch ^ ch1:
			print('YES')
		else:
			print('NO')


import sys
import math
from collections import defaultdict, Counter, deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for j in a:
		ans ^= j
	if ans == 0:
		print('YES')
		continue
	cur = 0
	cnt = 0
	for j in a:
		cur ^= j
		if cur == ans:
			cur = 0
			cnt += 1
	if cur == 0 and cnt > 1:
		print('YES')
	else:
		print('NO')


def proB(arr):
	k = 0
	for i in range(len(arr) - 1):
		k = k ^ arr[i]
		j = i + 1
		k2 = 0
		lst = []
		while j < len(arr):
			k2 = k2 ^ arr[j]
			if k2 == k:
				lst.append(k2)
				k2 = 0
			j += 1
		if k2 == 0 and k in lst:
			print('YES')
			return
	print('NO')
	return
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	proB(arr)


t = int(input())
for i in range(t):
	n = int(input())
	w = [int(k) for k in input().split()]
	c = 0
	for j in w:
		c = c ^ j
	eta = 0
	res = 0
	for j in w:
		eta = eta ^ j
		if eta == c:
			res += 1
			eta = 0
	if res > 1 or c == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline

def solve(lis, n):
	xor = 0
	for i in range(n - 1):
		xor ^= lis[i]
		j = i + 1
		temp_xor = 0
		while j < n:
			last = -1
			while j < n:
				temp_xor ^= lis[j]
				if temp_xor == xor:
					last = j
				j += 1
			if last == n - 1:
				print('YES')
				return
			if last == -1:
				break
			j = last + 1
			temp_xor = 0
	print('NO')
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	solve(lis, n)


I = input
IN = lambda x: map(int, x.split())
L = lambda x: list(IN(x))
for _ in range(int(I())):
	n = int(I())
	a = L(I())
	x = 0
	for i in a:
		x = x ^ i
	if x == 0:
		print('YES')
	else:
		c = 0
		y = 0
		for i in a:
			y = y ^ i
			if y == x:
				c += 1
				y = 0
				if c == 2:
					print('YES')
					break
		if c == 1:
			print('NO')


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p_xor = [0] * n
	s_xor = [0] * n
	s_xor[-1] = a[-1]
	p_xor[0] = a[0]
	for i in range(1, n):
		p_xor[i] = p_xor[i - 1] ^ a[i]
	for i in range(n - 2, -1, -1):
		s_xor[i] = s_xor[i + 1] ^ a[i]
	triple = 0
	for i in range(n):
		for j in range(i + 2, n):
			if p_xor[i] == s_xor[j] and p_xor[-1] == p_xor[i]:
				triple = 1
	if triple or p_xor[-1] == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
from collections import Counter
from itertools import accumulate
import operator

def solve():
	n = int(input())
	A = [int(char) for char in input().split()]
	xor_acc = list(accumulate(A, operator.xor))
	total = xor_acc[-1]
	if total == 0:
		return True
	for (i, xor) in enumerate(xor_acc):
		if xor == total:
			next_start = i + 1
			sub_xor = list(accumulate(A[next_start:], operator.xor))
			if total in sub_xor:
				return True
	return False
for _ in range(int(input())):
	if solve():
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	acc_a = [x]
	i = 1
	while i < n and x ^ a[i] != 0:
		x = x ^ a[i]
		acc_a.append(x)
		i += 1
	if i == n:
		print('NO')
	elif i == n - 1:
		print('YES')
	else:
		y = 0
		for j in range(i + 1, n):
			y = y ^ a[j]
		if y == 0:
			print('YES')
		else:
			z = 0
			flag = False
			for k in reversed(range(1, i + 1)):
				z = z ^ a[k]
				if z == y and acc_a[k - 1] == y:
					flag = True
					break
			print('YES' if flag else 'NO')


def solve(n, A):
	f = []
	b = []
	t = 0
	for a in A:
		t = t ^ a
		f.append(t)
	t = 0
	for a in A[::-1]:
		t = t ^ a
		b.append(t)
	b = b[::-1]
	table = [[0] * n for i in range(n)]
	for i in range(n - 1):
		t = 0
		for j in range(i, n):
			t = t ^ A[j]
			table[i][j] = t
	for i in range(n - 1):
		if f[i] == b[i + 1]:
			return 'YES'
	for i in range(n - 2):
		for j in range(i, n - 1):
			if f[i] == b[j + 1] and f[i] == table[i + 1][j]:
				return 'YES'
	return 'NO'

def main():
	ans = []
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split(' ')))
		ans.append(solve(n, a))
	for a in ans:
		print(a)
main()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	data = list(map(int, sys.stdin.readline().split()))
	temp = 0
	for i in range(len(data)):
		temp ^= data[i]
	if temp == 0:
		print('YES')
		continue
	cnt = 0
	cnt_temp = 0
	for i in range(len(data)):
		cnt_temp ^= data[i]
		if cnt_temp == temp:
			cnt += 1
			cnt_temp = 0
	print('YES' if cnt >= 3 else 'NO')


def win(lst):
	count = 0
	x = 0
	for i in range(n):
		x = x ^ lst[i]
	if x == 0:
		print('YES')
		return
	else:
		k = 0
		for i in range(n):
			k ^= lst[i]
			if k == x:
				k = 0
				count += 1
	if count >= 2:
		print('YES')
	else:
		print('NO')
t = int(input())
while t:
	n = int(input())
	lst = list(map(int, input().split()))
	win(lst)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in a:
		xor ^= i
	if xor == 0:
		print('YES')
	else:
		count = 0
		curxor = 0
		for i in a:
			curxor ^= i
			if curxor == xor:
				count += 1
				curxor = 0
		if curxor == 0 and count >= 2:
			print('YES')
		else:
			print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	aa = [int(x) for x in input().split()]
	bb = [aa[0]]
	for i in range(1, len(aa)):
		bb.append(aa[i] ^ bb[i - 1])
	if bb[-1] == 0:
		print('YES')
	else:
		last_val = bb[-1]
		zero_pos = None
		for i in range(len(bb) - 1, -1, -1):
			if bb[i] == 0:
				zero_pos = i
				break
		if zero_pos is None:
			print('NO')
		else:
			same_last_pos = None
			for i in range(zero_pos - 1, -1, -1):
				if bb[i] == last_val:
					same_last_pos = i
					break
			if same_last_pos is None:
				print('NO')
			else:
				print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	for i in range(n):
		a ^= l[i]
	if a == 0:
		print('YES')
	else:
		b = 0
		c = 0
		for i in l:
			b ^= i
			if b == a:
				c += 1
				b = 0
		if c >= 2:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	array = [int(j) for j in input().split()]
	a = 0
	xor = []
	for j in range(n):
		a = a ^ array[j]
		xor.append(a)
	if a == 0:
		print('YES')
	else:
		c = xor.index(a)
		if 0 in xor[c + 1:]:
			print('YES')
		else:
			print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	if len(set(l)) == 1:
		print('YES')
	else:
		x = 0
		for i in range(n):
			x ^= l[i]
		if x == 0:
			print('YES')
		else:
			c = 0
			t = 0
			for i in range(n):
				t ^= l[i]
				if t == x:
					c += 1
					t = 0
			if c > 2:
				print('YES')
			else:
				print('NO')


def solve(a1, a2, n):
	for i in range(n - 1):
		if a1[i] == a2[i + 1]:
			return 'YES'
	for i in range(n - 1):
		if a2[i + 1] == 0:
			x = a1[i]
			for j in range(i + 1, n):
				if a2[j] == x:
					return 'YES'
	return 'NO'
t = int(input())
for j in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	prearr = []
	postarr = []
	for i in range(n):
		prearr.append(arr[i])
		postarr.append(arr[i])
	for i in range(1, n):
		prearr[i] = prearr[i - 1] ^ arr[i]
	for i in range(n - 2, -1, -1):
		postarr[i] = postarr[i + 1] ^ arr[i]
	print(solve(prearr, postarr, n))