#include<bits/stdc++.h>
using namespace std;
using ll = long long;

vector<vector<int>> paths[205];

void Solve() {
  int i, j, k;
  int n, m;

  cin >> n >> m;
  assert(4<=n && n<=100000);
  assert(20<=m && m<=200);
  vector<int> cost(n);
  for (i = 0; i < n; ++i) {
    cin >> cost[i];
    assert(0<=cost[i] && cost[i]<=1e9);
  }

  vector<int> nodes;
  int ans = -1;
  for (i = 1; i < n; ++i) nodes.push_back(i);

  do {
    ll path_cost = (cost[0]^cost[nodes[0]]) + (cost[0]^cost[nodes.back()]);
    for (i = 1; i < nodes.size(); ++i) path_cost += cost[nodes[i]]^cost[nodes[i-1]];
    path_cost %= m;
    paths[path_cost].push_back(nodes);
    if (paths[path_cost].size()>2) {
      ans = path_cost;
      break;
    }
  } while (next_permutation(nodes.begin(), nodes.end()));

  if (ans == -1) {
    cout << "No" << endl;
  } else {
    cout << "YES" << endl;
    for (i = 0; i < 3; ++i) {
      cout << 1;
      for (j = 0; j < paths[ans][i].size(); ++j) {
        cout << " " << paths[ans][i][j]+1;
      }
      cout << " " << 1 << endl;
    }
  }

  for (i = 0; i < m; ++i) paths[i].clear();
}

int main() {
  int t;
  cin >> t;
  assert(1<=t && t<=25000);
  while (t--) Solve();
}
