#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repo(i, n) for (int i = 1; i <= n; i++)
#define foreach(c, itr) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define endl '\n'
typedef vector<int> vii;
typedef vector<int> vll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 1e7 + 4;

ll powmod(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res % MOD;
}

int gcd(int a, int b)
{
    while (b > 0)
    {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

ll is_prime(ll n)
{
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (ll i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}
int modI(int a, int m)
{
    int m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

long long mod_inv(long long a, long long m = MOD)
{
    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;
}

long long choose(long long n, long long r)
{
    long long product = 1;

    for (long long i = 0; i < r; i++)
        product = product * (n - i) % MOD * mod_inv(i + 1) % MOD;

    return product;
}
long long getcount(long long n, int k)
{
    long long res = (n >> (k + 1)) << k;

    if ((n >> k) & 1)

        res += n & ((1ll << k) - 1);

    return res;
}
int bit[N];

void init(void)
{
    int i;
    rep(i, N) bit[i] = 0;
}

void update(int idx, int val)
{
    while (idx <= N)
    {
        bit[idx] = max(bit[idx], val);
        idx += idx & -idx;
    }
}

int pref(int idx)
{
    int ans = 0;
    while (idx > 0)
    {
        ans = max(ans, bit[idx]);
        idx -= idx & -idx;
    }
    return ans;
}
// long long get(vector<long long> &f, int pos) {
//     long long res = 0;
//     for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
//         res += f[pos];
//     return res;
// }

// void upd(vector<long long> &f, int pos, int val) {
//     for (; pos < int(f.size()); pos |= pos + 1) {
//         f[pos] += val;
//     }
// }
// int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
// int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
// int dx[4]={-1, +1, 0, 0};
// int dy[4]={0, 0, +1, -1};
/*************************************************************************************************************/
// bool prime[N];
// int p[N];
// void pre()
// {
//     for (int i = 2; i < N; i++)
//     {
//         if (!prime[i])
//         {
//             // p.pb(i);
//             for (int j = i; j < N; j += i)
//             {
//                 if (p[j] == 0)
//                     p[j] = i;
//                 if (i != j)
//                     prime[j] = true;
//             }
//         }
//     }
// }
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        ll a[n];
        rep(i, n) cin >> a[i];
        ll pre[n];
        pre[0] = a[0];
        //suf[n - 1] = a[n - 1];
        for (int i = 1; i < n; i++)
            pre[i] = a[i] ^ pre[i - 1];
        bool ans = false;
        int i = n - 1;
        while (a[i] == 0)
            i--, n--;
        for (int i = 0; i < n - 1; i++)
        {
            ll x = pre[i];
            ll cur = 0, p = 0;
            for (int j = i + 1; j < n; j++)
            {
                cur ^= a[j];
                if (cur == x)
                    cur = 0, p = j;
            }
            if (p == n - 1)
                ans = true;
        }
        if (ans)
            c("YES") else c("NO")
    }
    return 0;
}
