#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;

#define FIO() ios_base::sync_with_stdio(0);cin.tie(NULL);

const int mx = 1e5 + 9;

ll a[mx];
vector <int> perm_list[mx];
vector <int> perm[mx];

int main() {
    FIO();

    int tc; cin >> tc;
    while (tc--) {
        int n, m;
        cin >> n >> m;

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

        for (int i = 0; i < m; i++) perm_list[i].clear();

        vector <int> p;
        for (int i = 2; i <= n; i++) p.push_back(i);

        int sz = p.size();
        int cnt = 0;
        bool ok = false;

        do {
            ll cost = 0;
            for (int i = 1; i < sz; i++) {
                cost += (a[p[i]] ^ a[p[i - 1]]);
                cost %= m;
            }

            cost += (a[p.back()] ^ a[1]);
            cost += (a[p[0]] ^ a[1]);
            cost %= m;

            perm[cnt].clear();

            perm[cnt].push_back(1);
            for (int x : p) perm[cnt].push_back(x);
            perm[cnt].push_back(1);

            perm_list[cost].push_back(cnt);

            cnt++;

            if (perm_list[cost].size() == 3) {
                cout << "Yes\n";
                for (int idx : perm_list[cost]) {
                    for (int x : perm[idx]) {
                        cout << x << " ";
                    }
                    cout << '\n';
                }

                ok = true;
                break;
            }

        } while (next_permutation(p.begin(), p.end()));

        if (!ok) cout << "No\n";
    }
}
