#include <bits/stdc++.h>
using namespace std;
const int MAXN = 8e4;
bool vis[MAXN + 5];
int a[MAXN + 5], b[MAXN + 5];
int n;
bool flag;
bool Check() {
  for (int i = 1; i <= n - 2; i++)
    if (b[i] ^ b[i + 2] != b[i + 1]) return false;
  return true;
}
void dfs(int id, int x) {
  if (flag) return;
  printf("id:%d x:%d\n", id, x);
  b[id] = x;
  if (id == n) {
    if (Check()) {
      printf("Yes\n");
      flag = true;
    }
    return;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      vis[i] = 1;
      dfs(id + 1, a[i]);
      vis[i] = 0;
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    flag = false;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    dfs(0, 0);
    if (!flag) printf("No\n");
  }
  return 0;
}
