#include <bits/stdc++.h>

const int N = 100005;

int query(int a, int b, int c) {
  printf("? %d %d %d\n", a, b, c);
  fflush(stdout);
  int ans;
  return scanf("%d", &ans), ans;
}

int ans[N];

int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    int a = 0, b = 0;
    for (int x = 1; x <= 13 && !a; ++x) {
      for (int y = x + 1; y <= 13 && !a; ++y) {
        for (int z = y + 1; z <= 13 && !a; ++z) {
          if (query(x, y, z) <= (n - 4) / 6) a = x, b = y;
        }
      }
    }
    std::map<int, std::vector<int>> mp;
    for (int i = 1; i <= n; ++i) {
      if (i != a && i != b) mp[query(a, b, i)].push_back(i);
    }
    int v = mp.rbegin()->first;
    int p1 = mp[v].front(), x1 = mp[v - 1][0];
    if (mp[v - 1].size() > 1) {
      int x2 = mp[v - 1][1];
      if (query(p1, x1, a) > query(p1, x2, a)) std::swap(x1, x2);
    }
    ans[p1] = 1, ans[x1] = 2;
    for (int i = 1; i <= n; ++i) {
      if (i != p1 && i != x1) ans[i] = query(p1, x1, i) + 2;
    }
    if (ans[1] > ans[2]) {
      for (int i = 1; i <= n; ++i) ans[i] = n - ans[i] + 1;
    }
    putchar('!');
    for (int i = 1; i <= n; ++i) printf(" %d", ans[i]);
    puts("");
    fflush(stdout);
    int sta;
    scanf("%d", &sta);
  }
  return 0;
}
