#include<bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
#define FOR(i,init,len) for(int i=(init);i<(len);++i)
#define For(i,init,len) for(int i=(init);i<=(len);++i)
#define fi first
#define se second
#define pb push_back
#define is insert
namespace IO {
	inline char getchar() {
		static const int BUFSIZE=5201314;
		static char buf[BUFSIZE],*begin,*end;
		if(begin==end) {
			begin=buf;
			end=buf+fread(buf,1,BUFSIZE,stdin);
			if(begin==end) return -1;
		}
		return *begin++;
	}
}
inline void read(int &in) {
	int c,symbol=1;
	while(isspace(c=IO::getchar()));
	if(c=='-') { in=0;symbol=-1; }
	else in=c-'0';
	while(isdigit(c=IO::getchar())) { in*=10;in+=c-'0'; }
	in*=symbol;
}
inline int read() { static int x;read(x);return x; }
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
#define PA(name,init,len) cout<<#name"["<<(len-init)<<"]=";FOR(_,init,len) cout<<name[_]<<" \n"[_==(len-1)];
#define Pa(name,init,len) cout<<#name"["<<(len-init+1)<<"]=";For(_,init,len) cout<<name[_]<<" \n"[_==(len)];
#define PV(name) cout<<#name"="<<name<<'\n';

const int maxn = 2e3+10;
int in[maxn];
int n;

bool check(int ans){
  int cur = 0;
  int end=-1,seg=0;
  FOR(i,0,n){
    cur^=in[i];
    if(cur==ans) {
      cur=0;
      end = i;
      seg++;
    }
  }
  if(seg>=2&&(end==n-1||cur==0)) return true;
  return false;
};

int main(int argc,char **argv) {
#ifdef MengLan
	int Beginning=clock();
	// freopen("sample_save_1.as","r",stdin);
	// freopen(argv[2],"wb",stdout);
#endif // MengLan

  int T;scanf("%d",&T);
  while(T--){
    scanf("%d",&n);
    FOR(i,0,n) scanf("%d",in+i);
    int cur = 0;
    bool flag = true;
    FOR(i,0,n){
      cur^=in[i];
      if(check(cur)){
        printf("YES\n");
        flag = false;
        break;
      }
    }
    if(flag) printf("NO\n");
  }

#ifdef MengLan
	printf("Time: %ld\n",clock()-Beginning);
    // system("pause");
#endif // MengLan
	return 0;
}