#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 100005;
int T, n, p[maxn], flag = 0;
int ask(int a, int b, int c) {
    assert(1 <= a && a <= n && 1 <= b && b <= n && 1 <= c && c <= n);
    assert(a != b && a != c && b != c);
    cout << "? " << a << " " << b << " " << c << endl;
    if(flag) {
        int x = 0;
        scanf("%d", &x);
        return x;
    }
    int t[3] = {p[a], p[b], p[c]};
    sort(t, t + 3);
    return max(t[1] - t[0], t[2] - t[1]);
}
int ans[maxn];
inline int Rand(int l, int r) {
    return rand() % (r - l + 1) + l;
}
vector<int> A[maxn];
void solve() {
    scanf("%d", &n);
    if(!flag) {
        for(int i = 1; i <= n; i++)
            scanf("%d", &p[i]);
    }
    srand(time(0));
    int a = 0, b = 0, c = 0;
    do {
        do {
            a = Rand(1, n), b = Rand(1, n), c = Rand(1, n);
        }while(a == b || b == c || a == c);
    }while(ask(a, b, c) > (n - 4) / 6);
    for(int i = 1; i <= n; i++)
        A[i].clear();
    for(int i = 1; i <= n; i++)
        if(i != a && i != b) A[ask(a, b, i)].push_back(i);
    int d = n;
    for(; !A[d].size(); d--);
    int pos1 = A[d][0];
    ans[pos1] = 1;
    int pos2 = A[d - 1][0];
    if(A[d - 1].size() >= 2 && ask(pos1, A[d - 1][0], a) > ask(pos1, A[d - 1][1], a)) 
        pos2 = A[d - 1][1];
    ans[pos2] = 2;
    for(int i = 1; i <= n; i++)
        if(i != pos1 && i != pos2)
            ans[i] = ask(pos1, pos2, i) + 2;
    if(ans[1] > ans[2]) {
        for(int i = 1; i <= n; i++)
            ans[i] = n - ans[i] + 1;
    }
    printf("! ");
    for(int i = 1; i <= n; i++)
        printf("%d ", ans[i]);
    cout << endl;
    cin >> n;
}
int main() {
    flag = 1;
    int T = 1;
    if(flag)
        scanf("%d", &T);
    while(T--) solve();
    return 0;
}