#include <bits/stdc++.h>

using namespace std;

typedef  unsigned long long ll;

int main(){
 ios::sync_with_stdio(0);cin.tie(0);
 int t; cin >> t;
 while(t > 0){
 	t--;
 	int n; cin >> n;
 	bool yap = false;
 	vector<ll>arr(n);
 	for(int i = 0; i < n; i++)cin >> arr[i];
 	vector<ll> suff(n), pref(n);
 	pref[0] = arr[0];
 	for(int i = 1; i < n; i++){
 		pref[i] = pref[i - 1] ^ arr[i];
 	}
 	suff[n - 1] = arr[n - 1];
 	for(int i = n - 2; i > -1; i--){
 		suff[i] = suff[i + 1]^arr[i];
 	}
 	for(int i = 1; i < n; i++){
 		ll xr = 0;
 		ll sxr = pref[i - 1];
 		for(int j = i; j < n - 1; j++){
 			xr ^= arr[j];
 			if(xr == sxr && xr == suff[j + 1])yap = true;
 		}
 	}
 	if(yap || pref.back() == 0)cout << "YES" << endl;
 	else cout << "NO" << endl;
 }
}