#include <bits/stdc++.h>
using namespace std;
inline void solve() {
  long long n;
  cin >> n;
  bool ok = true;
  map<long long, long long> cnt;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  if ((long long)cnt.size() == 1 and a[0] == 0)
    ok = true;
  else if ((long long)cnt.size() == 1 and a[0] != 0)
    ok = false;
  else if (n % 3 or (long long) cnt.size() > 3)
    ok = false;
  else if ((long long)cnt.size() % 3 == 0) {
    long long h[3], i = 0;
    for (auto &it : cnt) h[i++] = it.first;
    if ((h[0] ^ h[1] ^ h[2]) != 0) ok = false;
  } else if ((long long)cnt.size() % 3 == 2) {
    long long h[2], i = 0, k = -1;
    for (auto &it : cnt) {
      h[i++] = it.second;
      if (k == -1) k = it.first;
    }
    if (k != 0 or h[1] != h[0] * 2) ok = false;
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
signed main() {
  long long n = 1;
  cin >> n;
  while (n--) solve();
  return 0;
}
