
// Problem : B. AGAGA XOOORRR
// Contest : Codeforces - Codeforces Round #717 (Div. 2)
// URL : https://codeforces.com/contest/1516/problem/B
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vvi vector<vector<int> >
#define vb vector<bool>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define pii pair<int,int>
#define mii map<int,int>
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mkp make_pair
#define all(v) v.begin(),v.end()
#define input(a,b,n) for(i=b;i<n;i++){cin>>a[i];}
#define print(a) for(i=0;i<a.size();i++){cout<<a[i]<<" ";}cout<<endl;
#define trace1(a); cout<<"a="<<a<<endl;
#define trace2(a,b); cout<<"a="<<a<<" b="<<b<<endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int inf=0x3f3f3f3f3f3f3f3f;
int power(int a, int b){
    int res = 1;
    while(b!=0){
        if(b&1){
            res *= a; 
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
int32_t main()
{
	fast;
    int t;
    //t=1;
    cin>>t;
    while(t--)
    {
    	int n;
    	cin>>n;
    	vi a(n);
    	int i;
    	input(a,0,n);
    	int x=0;
    	vi fr,bk(n);
    	for(i=0;i<n;i++){
    		x=x^a[i];
    		fr.pb(x);
    	}
    	x=0;
    	for(i=n-1;i>=0;i--){
    		x=x^a[i];
    		bk[i]=x;
    	}
    	// print(fr);
    	// print(bk);
    	bool flag=0;
    	for(i=0;i<n-1;i++){
    		if(fr[i]==bk[i+1]){
    			flag=1;
    			break;
    		}
    	}
    	if(flag)cout<<"YES"<<endl;
    	else{
    		bool flag1=0,flag2=0;
    		int xx=bk[0];
    		for(i=0;i<n-1;i++){
    			if(fr[i]==xx){
    				flag1=1;
    				break;
    			}
    		}
    		int j=n-1;
    		for(j=n-1;j>=0;j--){
    			if(bk[j]==xx){
    				flag2=1;
    				break;
    			}
    		}
    		if(flag1&&flag2&&i<j){
    			i++;
    			j--;
    			int xo=0;
    			for(int k=i;k<=j;k++){
    				xo=xo^a[k];
    			}
    			if(xo==xx){
    				flag=1;
    			}else{
    				flag=0;
    			}
    		}
    		if(flag)cout<<"YES"<<endl;
    		else cout<<"NO"<<endl;
    	}
	}
    return 0;
}
