#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define sc second
#define pb push_back
#define ll long long
#define trav(v,x) for(auto v:x)
using namespace std;
const int N = 1e6 + 100;

int n;
int a[N];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tt;
	cin >> tt;
	while(tt--)
    {
        cin >> n;
        int tot = 0;
        for(int i = 1; i <= n; i++)
            cin >> a[i], tot ^= a[i];
        if(tot == 0)cout << "YES" << '\n';
        else
        {
            int x = 0, ps1, ps2;
            for(int i = 1; i <= n; i++)
            {
                x ^= a[i];
                if(x == tot)
                {
                    ps1 = i;
                    break;
                }
            }
            x = 0;
            for(int i = n; i >= 1; i--)
            {
                x ^= a[i];
                if(x == tot)
                {
                    ps2 = i;
                    break;
                }
            }
            if(ps1 < ps2)
            {
                cout << "YES" << '\n';
            }
            else cout << "NO" << '\n';
        }
    }
	return 0;
}
