#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("O2")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#define fs first
#define se second
#define nl (string)"\n"
#define ll long long
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define sortall(x) sort(all(x))
#define m_p(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define prec(n) fixed<<setprecision(n)
#define bits(x) __builtin_popcountll(x)
#define rsort(x) sort(all(x), greater<int>())
#define fr(i, x, y) for (int i = (int)x; i < (int)y; ++i)
#define frr(i, x, y) for (int i = (int)x; i >= (int)y; --i)
typedef set<ll> sl;
typedef set<int> si;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;
typedef map<ll, ll> mll;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef unordered_set<ll> usl;
typedef unordered_set<int> usi;
typedef unordered_map<ll, ll> umll;
typedef unordered_map<int, int> umii;


//-------------------------------------DEGUG-----------------------------------------
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x <<" = "; wrt(x); wrt()
#define divider cout << "-------output-------\n"
#else
#define debug(x)
#define divider
#endif
//-----------------------------------------------------------------------------------


//--------------------------------------I/O------------------------------------------
void read() { return; }
void wrt() { cout << nl; }
void wrt(ll t) {cout << t ;}
void wrt(int t) {cout << t ;}
void wrt(char t) {cout << t ;}
void wrt(string t) {cout << t ;}
void wrt(double t) {cout << t ;}
template <class T> void wrt(set <T> v);
template <class T> void wrt(vector <T> v);
template <class T> void wrt(multiset <T> v);
template <class T, class V> void wrt(map <T, V> v);
template <class T, class V> void wrt(pair <T, V> p);
template <class T> void wrt(set <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T> void wrt(vector <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <size_t T> void wrt(const char (&a)[T]) { for (char c : a) { wrt(c); } wrt(); }
template <class T> void wrt(multiset <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T, class... V> void wrt(T x, V... args) { (wrt(x), wrt(' '), wrt(args...)); }
template <class T, class V> void wrt(map <T, V> v) { for (auto i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T, class V> void wrt(pair <T, V> p) { wrt(p.first); wrt(' '); wrt(p.second); wrt(); }
template <class T, class... V> void read(T &x, V &...args) { ((cin >> x), read(args...)); }
template <class T> void readArr(T &arr, int x, int y) { fr(i, x, y) cin >> arr[i]; }
//------------------------------------------------------------------------------------


//---------------------------------------CONST----------------------------------------
const int N = 1e6;
const int INF = 1e9;
//const ll INF = 1e18;
const int MOD = 1e9+7;
//const int MOD = 998244353;
//------------------------------------------------------------------------------------


//---------------------------------------FUNCT----------------------------------------
string S(string s) { return s; }
int countBits(ll number) { return (int)log2(number) + 1; }
ll gcd(ll a, ll b) { return (b == 0) ? (a) : (gcd(b, a %= b)); }
ll lcd(ll a, ll b) { return (a * b) / gcd(a, b); }
ll add(ll x, ll y) { return (x + y) % MOD; }
ll sub(ll x, ll y) { return (x - y + MOD) % MOD; }
ll mul(ll x, ll y) { return (x * 1ll * y) % MOD; }
ll inv(ll p, ll q) {ll expo=MOD-2; while(expo) { if (expo&1) p = mul(p, q); q = mul(q, q), expo >>= 1; } return p; }
ll power(ll x, ll y) { if (y == 0) return 1; else if (y % 2 == 0) { ll tmp = power(x, y / 2); return mul(tmp, tmp); } else return mul(x, power(x, y - 1)); }
//------------------------------------------------------------------------------------


//-------------------------------------CODE-IS-HERE-----------------------------------

void solveTestCase()
{
    int n;
    read(n);
    vi a(n);
    readArr(a, 0, n);
    int flag = 0;
    vi xa(n), xb(n);
    xa[0]=a[0], xb[n-1]=a[n-1];
    fr(i, 1, n) xa[i]=xa[i-1]^a[i];
    frr(i, n-2, 0) xb[i]=xb[i+1]^a[i];
    fr(i, 0, n-1){
        int x=0;
        fr(j, i+1, n){
            x^=a[j];
            if(j<n-1){
                if(x==xa[i] && x==xb[j+1]) flag=1;
            }else{
                if(x==xa[i]) flag=1;
            }
            if(flag) break;
        }
        if(flag) break;
    }
    if(flag) wrt(S("YES"));
    else wrt(S("NO"));
    wrt();
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    divider;
    int t=1;
    cin>>t;
    while(t--)
        solveTestCase();
    return 0;
}