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

using ll  = long long;
using pii = pair<int,int>;
#define dbg(n) cout<<'\n'<<#n<<" is "<<n<<'\n';
#define pb push_back
#define all(v) v.begin(), v.end()
#define cs(i) cout<<"Case "<<i+1<<": \n"; 
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"

const int N   = 2e3+5;
const int INF = 0x7fffffff;
int arr[N],pre[N],post[N];

void solve(){
        int n;
        cin>>n;
        for(int i=1;i<=n;i++){
                cin>>arr[i];
        }
        pre[0]=0;
        post[n+1];
        
        for(int i=1;i<=n;i++){
                pre[i]=pre[i-1]^arr[i];
        }
        for(int i=n;i>0;i--){
                post[i]=post[i+1]^arr[i];
        }
        bool f=0;
        for(int i=1;i<n;i++){
                if(pre[i]==post[i+1])
                        f=1;
        }
        for(int i=1;i<n;i++){
                for(int j=i+1;j<n;j++){
                        int a,b,c;
                        a=pre[i];
                        b=pre[j]^pre[i];
                        c=pre[n]^pre[j];
                        if(a==b and b==c) f=1;
                }
        }
        if(f) cout<<"YES\n";
        else cout<<"NO\n";
       // for(int i=1;i<=n;i++) cout<<pre[i]<<" "; cout<<endl;
        
}

int main(){
        int t=1; 
        FAST
        
        cin>>t;
        while(t--)
            solve();
        
        return 0;
}
