#include <iostream>
#define endl '\n'
using namespace std;

const int MAXN = 100000;

int s[MAXN + 5];
long long a[MAXN + 5];

void solve()
{
    int n;
    long long k;
    cin >> n >> k;

    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
    }

    long long b = (1ll << 61) - 1;
    for (int i = n; i > 1; -- i)
    {
        if (((a[i] & b) | k) != k)
        {
            b &= a[i];
            s[i] = 1;
        }
        else
        {
            s[i] = 0;
            b &= b - (b & a[i]);
        }
    }

    long long num = a[1];
    for (int i = 2; i <= n; ++ i)
    {
        if (s[i]) num &= a[i];
        else num |= a[i];
    }
    if (num == k)
    {
        cout << "YES" << endl;
        for (int i = 2; i <= n; ++ i)
        {
            if (s[i]) cout << "&";
            else cout << "|";
        }
        cout << endl;
    }
    else cout << "NO" << endl;
}

int main()
{
    ios :: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}
