#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define int ll
const int mxn = (int)2e5+7;
const int MOD = 998244353;
#define isON(n, k) (((n) >> (k)) & 1)
void GETAC(){
int n, x, y;
cin >> n >> x >> y;
vector<int> A(n), A1, A2;
for (int& i : A) cin >> i;
int mid(n / 2);
for (int msk(0); msk < (1 << mid); ++msk) {
int xr(0);
for (int i(0); i < mid; ++i)
if (isON(msk, i))
xr ^= A[i];
A1.emplace_back(xr);
}
for (int msk(0); msk < (1 << (n - mid)); ++msk) {
int xr(0);
for (int i(0); i < n-mid; ++i)
if (isON(msk, i))
xr ^= A[mid + i];
A2.emplace_back(xr);
}
sort(A1.begin(), A1.end()), sort(A2.begin(), A2.end());
bool ok_x, ok_y;
ok_x = ok_y = 0;
for (int& i : A1) {
if (!ok_x and binary_search(A2.begin(), A2.end(), x ^ i))
ok_x = 1;
if (!ok_y and binary_search(A2.begin(), A2.end(), y ^ i))
ok_y = 1;
if (ok_x and ok_y)
return void(cout << "YES");
}
cout << "NO";
}
signed main()
{
fastio
int t(1); cin >> t;
while(t--) GETAC(), cout << '\n';
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZmFzdGlvIGlvczo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKG51bGxwdHIpOyBjb3V0LnRpZShudWxscHRyKTsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBpbnQgbGwKY29uc3QgaW50IG14biA9IChpbnQpMmU1Kzc7CmNvbnN0IGludCBNT0QgPSA5OTgyNDQzNTM7CiNkZWZpbmUgaXNPTihuLCBrKSAoKChuKSA+PiAoaykpICYgMSkKCnZvaWQgR0VUQUMoKXsKCiAgICBpbnQgbiwgeCwgeTsKICAgIGNpbiA+PiBuID4+IHggPj4geTsKICAgIHZlY3RvcjxpbnQ+IEEobiksIEExLCBBMjsKICAgIGZvciAoaW50JiBpIDogQSkgY2luID4+IGk7CiAgICBpbnQgbWlkKG4gLyAyKTsKICAgIGZvciAoaW50IG1zaygwKTsgbXNrIDwgKDEgPDwgbWlkKTsgKyttc2spIHsKICAgICAgICBpbnQgeHIoMCk7CiAgICAgICAgZm9yIChpbnQgaSgwKTsgaSA8IG1pZDsgKytpKQogICAgICAgICAgICBpZiAoaXNPTihtc2ssIGkpKQogICAgICAgICAgICAgICAgeHIgXj0gQVtpXTsKCiAgICAgICAgICAgIEExLmVtcGxhY2VfYmFjayh4cik7CiAgICB9CgogICAgZm9yIChpbnQgbXNrKDApOyBtc2sgPCAoMSA8PCAobiAtIG1pZCkpOyArK21zaykgewogICAgICAgIGludCB4cigwKTsKICAgICAgICBmb3IgKGludCBpKDApOyBpIDwgbi1taWQ7ICsraSkKICAgICAgICAgICAgaWYgKGlzT04obXNrLCBpKSkKICAgICAgICAgICAgICAgIHhyIF49IEFbbWlkICsgaV07CgogICAgICAgICAgICBBMi5lbXBsYWNlX2JhY2soeHIpOwogICAgfQoKICAgIHNvcnQoQTEuYmVnaW4oKSwgQTEuZW5kKCkpLCBzb3J0KEEyLmJlZ2luKCksIEEyLmVuZCgpKTsKICAgIGJvb2wgb2tfeCwgb2tfeTsKICAgIG9rX3ggPSBva195ID0gMDsKICAgIGZvciAoaW50JiBpIDogQTEpIHsKICAgICAgICBpZiAoIW9rX3ggYW5kIGJpbmFyeV9zZWFyY2goQTIuYmVnaW4oKSwgQTIuZW5kKCksIHggXiBpKSkKICAgICAgICAgICAgb2tfeCA9IDE7CgogICAgICAgIGlmICghb2tfeSBhbmQgYmluYXJ5X3NlYXJjaChBMi5iZWdpbigpLCBBMi5lbmQoKSwgeSBeIGkpKQogICAgICAgICAgICBva195ID0gMTsKCiAgICAgICAgaWYgKG9rX3ggYW5kIG9rX3kpCiAgICAgICAgICAgIHJldHVybiB2b2lkKGNvdXQgPDwgIllFUyIpOwoKICAgIH0KICAgIGNvdXQgPDwgIk5PIjsKfQoKc2lnbmVkIG1haW4oKQp7CiAgICBmYXN0aW8KICAgIGludCB0KDEpOyBjaW4gPj4gdDsKICAgIHdoaWxlKHQtLSkgR0VUQUMoKSwgY291dCA8PCAnXG4nOwp9