#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        ll n, ans = 0;
        cin >> n;
        vector <ll> a(n + 1);
        vector <ll> b(n + 2, 0);
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            ans = (ans ^ a[i]);
            b[i] = b[i - 1] ^ a[i];
        }
        if (ans == 0)
            cout << "YES\n";
        else
        {
            bool f = 0;
            for (int i = 1; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if ((b[i] ^ b[0]) == ans and (b[j] ^ b[i]) == ans and (b[n] ^ b[j]) == ans)
                    {
                        f = 1;
                    }

                }
            }
            if (f)
                cout << "YES\n";
            else
                cout << "NO\n";
        }
        /*for (auto c : a)
            cout << c << " ";
        cout << "\n";*/
    }
    return 0;
}
