#include <bits/stdc++.h>
using namespace std;
const int MAXN = int(1e5 + 5);
int T, n;
long long A;
map<long long, int> cnt;
vector<long long> G;
int main() {
  scanf("%d", &T);
  while (T--) {
    G.clear();
    cnt.clear();
    scanf("%d", &n);
    int t = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &A);
      if (cnt[A] == 0) {
        t++;
        G.push_back(A);
      }
      cnt[A]++;
    }
    if (cnt[0] == n) {
      puts("Yes");
      continue;
    };
    if (t > 3 || n % 3 != 0) {
      puts("No");
      continue;
    };
    if (t == 1) {
      puts("No");
      continue;
    };
    if (t == 2) {
      if (cnt[0] == n / 3) {
        puts("Yes");
        continue;
      };
      {
        puts("No");
        continue;
      };
    }
    long long d = G[0] ^ G[1] ^ G[2];
    if (d == 0LL && cnt[G[0]] == n / 3 && cnt[G[1]] == n / 3 &&
        cnt[G[2]] == n / 3) {
      puts("Yes");
      continue;
    };
    {
      puts("No");
      continue;
    };
  }
}
