	// author: sharad12arse
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define gcd __gcd
#define INF LONG_LONG_MAX

void solve(){
	int n;
	cin>>n;
	ll a1=0,a2=0,x=0;
	vector<ll> arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
		x^=arr[i];
	}
	a2=x;
	for(int i=0;i<n-1;i++){
		a1^=arr[i];
		a2^=arr[i];
		if(a1==a2){
			cout<<"YES\n";
			return;
		}
	}
	a1=0,a2=0;
	for(int i=0;i<n-1;i++){
		a1^=arr[i];
		a2=0;
		for(int j=n-1;j>i;j--){
			a2^=arr[j];
			if(a1==a2&&((x^a1)^a2)==a1){
				cout<<"YES\n";
				return;
			}
		}
	}
	cout<<"NO\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
}
