#include<iostream>
using namespace std;
int arr[2001];
void solve(){
	int i,j,n;
	bool flag;
	cin>>n;
	for(i=1;i<=n;i++){
		int a; cin>>a;
		arr[i]=(arr[i-1]^a);
	}
	if(!arr[n]){cout<<"YES\n";return;}
	for(i=1;i<=n;i++){
		for(j=i+1;j<n;j++){
			if(arr[i]==(arr[j]^arr[i])&&arr[i]==arr[n]^arr[j]){cout<<"YES\n";return;}
		}
	}
	cout<<"NO\n";
}
int main(){
	int T;
	cin>>T;
	while(T--)solve();
}