#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <math.h>
#include <tuple>
#define ll long long
#define pb push_back
#define pf push_front
#define INF 1e10
#define NINF -1e9
#define endl "\n"
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
//#define pi 3.14159265358
#define mod 1000000007
#define done(x) {cout << x << endl;return;}
#define F first
#define S second
using namespace std;
// DEBUG FUNCTIONS 

#ifndef ONLINE_JUDGE

template<typename T>
void __p(T a) {
    cout<<a;
    
}
template<typename T, typename F>
void __p(pair<T, F> a) {
    cout<<"{";
    __p(a.first);
    cout<<",";
    __p(a.second);
    cout<<"}";
    cout<<endl; 
}
template<typename T>
void __p(std::vector<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it<a.end(); it++)
        __p(*it),cout<<",}"[it+1==a.end()];
    
}
template<typename T>
void __p(std::set<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it!=a.end();){
        __p(*it); 
        cout<<",}"[++it==a.end()];
    }
    cout<<endl; 

}
template<typename T>
void __p(std::multiset<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it!=a.end();){
        __p(*it); 
        cout<<",}"[++it==a.end()];
    }
    
}
template<typename T, typename F>
void __p(std::map<T,F> a) {
    cout<<"{\n";
    for(auto it=a.begin(); it!=a.end();++it)
    {
        __p(it->first);
        cout << ": ";
        __p(it->second);
        cout<<"\n";
    }
    cout << "}\n";
}

template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
    __p(a1);
    __p(a...);

}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";
    __p(arg1);
    cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(;; i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<" | ";
    __f(comma+1,args...);
}
#define deb(x...)  __p(x)
#define trace(...) cout<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#define error(...)
#define deb(x...) 

#endif

// DEBUG FUNCTIONS END 


ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}
/*
ll int fact[200001];
ll int rfact[200001];*/
ll int power(ll int a, ll int b){
    if(b==0) return 1;
    else if(b==1) return a;
    else if(b%2==0) return(((power(a,b/2)%mod)*(power(a,b/2)%mod))%mod);
    else return (a*(power(a,b-1)))%mod;
}
/*
void precal(){
      fact[0]=1;
    for(int i=1;i<=200000;++i)
        fact[i]=fact[i-1]*i%mod;
    rfact[200000]=power(fact[200000],mod-2);
    for(int i=200000;i;--i)
        rfact[i-1]=rfact[i]*i%mod;
}
ll divide(ll a,ll b) {
    return (a % mod) * power(b, mod - 2) % mod;
}
*/

struct node
{
    ll x, y;

};

bool cmp(node a, node b)
{
    return a.x < b.x;
}


void solve(int t){
    int n; cin>>n; 
    ll a[n]; for(int i=0; i<n; i++) cin>>a[i];
    ll b=false;
    for(int i=1; i<n; i++){
        if(a[i]!=a[i-1]) b=true;
    }
    //if(!b) done("YES");
    ll left[n],right[n];
    left[0] = a[0]; right[n-1]=a[n-1];
    for(int i=1; i<n; i++){
        left[i] = left[i-1]^a[i];
    }
    for(int i=n-2; i>=0; i--){
        right[i] = right[i+1]^a[i];
    }
    for(int i=0; i<n-1; i++){
        if(left[i] == right[i+1]) done("YES");
        for(int j=i+1; j<n-1; j++){
            ll d = left[n-1]^left[i]^right[j+1];
            if(left[i] == right[j+1] && d == left[i] ){
                done("YES");
            }
        }
    }

    done("NO");
}


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output2.txt", "w", stdout);
    #endif

    int tc=1; cin>>tc;
    for(int i=1; i<=tc; i++) solve(i); 
    
    
}