#include <bits/stdc++.h>
#define forn(i,n) for(ll i=0; i<n; i++)
#define pb push_back
#define ll long long int
#define mp make_pair
#define sz(arr) (ll)arr.size()
#define MOD 1000000007
using namespace std;

int main(){
	ll T;
	cin>>T;
	while (T--){
		ll n;
		cin>>n;
		vector<ll> arr(n);
		forn(i,n) cin>>arr[i];
		vector<ll> prev(n);
		prev[0]=arr[0];
		forn(i,n-1){
			prev[i+1]=prev[i]^arr[i+1];
		}
		
		if (prev[n-1]==0){
			cout<<"YES\n";
			goto gg;
		}
		
		forn(i,n-2){
			for(ll j=i+1; j<n-1; j++){
				if (prev[i]==(prev[i]^prev[j]) and prev[i]==(prev[j]^prev[n-1])){
					cout<<"YES\n";
					goto gg;
				}
			}
		}
		
		cout<<"NO\n";
		gg:;
	}
}
