#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int getrand(int n) {
    return((int(rand()) % 107 * 107 * 107 + rand() % 107 * 107 + rand() % 107) % n + 1);
}

void testrand(int n, int& t1, int& t2) {
    const int trial = 10;
    int arr[trial + 1] = {};
    int minres = n + 1;
    for (int i = 1; i <= trial; i++) {
        for (int j = i + 1; j <= trial; j++) {
            for (int k = j + 1; k <= trial; k++) {
                cout << "? " << i << ' ' << j << ' ' << k << endl;
                int temp;
                cin >> temp;
                if (temp < minres) {
                    minres = temp;
                    t1 = i;
                    t2 = j;
                }
            }
        }
    }
    return;
}

int arr[200000] = {};

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;
    for (int i = 1; i <= t; i++) {
        int n;
        cin >> n;
        int t1, t2;
        testrand(n, t1, t2);
        int max1 = 0, maxind1, max2 = 0, maxind2, max3 = 0, maxind3;
        for (int j = 1; j <= n; j++) {
            if (j != t1 && j != t2) {
                cout << "? " << t1 << ' ' << t2 << ' ' << j << endl;
                int temp;
                cin >> temp;
                if (temp > max1) {
                    max3 = max2; maxind3 = maxind2;
                    max2 = max1; maxind2 = maxind1;
                    max1 = temp; maxind1 = j;
                } else if (temp > max2) {
                    max3 = max2; maxind3 = maxind2;
                    max2 = temp; maxind2 = j;
                } else if (temp > max3) {
                    max3 = temp; maxind3 = j;
                }
            }
        }
        if (max1 > max2 && max2 > max3) {
            arr[maxind1] = n; arr[maxind2] = n - 1;
        } else if (max1 == max2) {
            int a1, a2;
            int t3 = 0;
            do {
                t3++;
                while (t3 == maxind1 || t3 == maxind2 || t3 == maxind3) t3++;
                cout << "? " << t3 << ' ' << maxind1 << ' ' << maxind3 << endl;
                cin >> a1;
                cout << "? " << t3 << ' ' << maxind2 << ' ' << maxind3 << endl;
                cin >> a2;
                if (a1 * 2 >= n + 3 && a2 * 2 <= n - 3) {
                    arr[maxind2] = n; arr[maxind3] = n - 1;
                    maxind1 = maxind2; maxind2 = maxind3;
                    break;
                } else if (a1 * 2 <= n - 3 && a2 * 2 >= n + 3) {
                    arr[maxind1] = n; arr[maxind3] = n - 1;
                    maxind2 = maxind3;
                    break;
                }
            } while (1);
        } else {
            int a1, a2;
            int t3 = 0;
            do {
                t3++;
                while (t3 == maxind1 || t3 == maxind2 || t3 == maxind3) t3++;
                cout << "? " << t3 << ' ' << maxind1 << ' ' << maxind3 << endl;
                cin >> a1;
                cout << "? " << t3 << ' ' << maxind1 << ' ' << maxind2 << endl;
                cin >> a2;
                if (a1 * 2 >= n + 3 && a2 * 2 <= n - 3) {
                    arr[maxind1] = n; arr[maxind2] = n - 1;
                    break;
                } else if (a1 * 2 <= n - 3 && a2 * 2 >= n + 3) {
                    arr[maxind1] = n; arr[maxind3] = n - 1;
                    maxind2 = maxind3;
                    break;
                }
            } while (1);
        }
        for (int j = 1; j <= n; j++) {
            if (j != maxind1 && j != maxind2) {
                cout << "? " << maxind1 << ' ' << maxind2 << ' ' << j << endl;
                int temp;
                cin >> temp;
                arr[j] = n - 1 - temp;
            }
        }
        cout << "!";
        for (int j = 1; j <= n; j++) {
            if (arr[1] < arr[2]) cout << " " << arr[j]; else cout << " " << n + 1 - arr[j];
        }
        cout << endl;
        cin >> t1;
    }
    return(0);
}
