#include <bits/stdc++.h>
using namespace std;
const int MAXN = 80005;
int T, N, Cnt, cnt[5];
long long num[MAXN];
long long A[MAXN];
void Check(int t) {
  if (t == N) {
    printf("Yes\n");
    return;
  }
  if (t * 3 == N) {
    Cnt = 0;
    num[1] = num[2] = num[3] = -1;
    for (int i = 1; i <= N; i++) {
      if (A[i] == num[1]) continue;
      if (A[i] == num[2]) continue;
      num[++Cnt] = A[i];
    }
    if (Cnt != 2) {
      printf("No\n");
      return;
    }
    printf("Yes\n");
    return;
  }
  printf("No\n");
}
void Solve() {
  int Ok = 0;
  for (int i = 1; i <= N; i++)
    if (!A[i]) Ok++;
  if (Ok) {
    Check(Ok);
    return;
  }
  if (N % 3) {
    printf("No\n");
    return;
  }
  Cnt = 0;
  num[1] = num[2] = num[3] = -1;
  for (int i = 1; i <= N; i++) {
    if (A[i] == num[1]) continue;
    if (A[i] == num[2]) continue;
    if (A[i] == num[3]) continue;
    num[++Cnt] = A[i];
  }
  if (Cnt != 3) {
    printf("No\n");
    return;
  }
  if ((num[1] ^ num[2]) != num[3]) {
    printf("No\n");
    return;
  }
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= N; i++) {
    if (A[i] == num[1]) cnt[1]++;
    if (A[i] == num[2]) cnt[2]++;
    if (A[i] == num[3]) cnt[3]++;
  }
  if (cnt[1] == cnt[2] && cnt[2] == cnt[3]) {
    printf("Yes\n");
    return;
  }
  printf("No\n");
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) scanf("%lld", &A[i]);
    Solve();
  }
}
