#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
template <typename T> void write(T t) {
	if (t<0) { putchar('-'); write(-t); return; }
	if (t>9) write(t/10);
	putchar('0'+t%10);
}
template <typename T> void writeln(T t) { write(t); puts(""); }
const int maxn=(1e5)+10;
int T,n,AA[maxn],cnt,a[maxn];
int Median(int x,int y,int z) { return x+y+z-max(max(x,y),z)-min(min(x,y),z); }
int query(int x,int y,int z) {
	cnt++;
	//return Median(abs(AA[x]-AA[y]),abs(AA[y]-AA[z]),abs(AA[z]-AA[x]));
	printf("? %d %d %d\n",x,y,z); fflush(stdout);
	scanf("%d",&x); return x;
}
vector<int> g[maxn];
int main() {
	scanf("%d",&T);
	while (T--) {
		scanf("%d",&n);
		//for (int i=1;i<=n;i++) scanf("%d",&AA[i]);
		int x,y,z; srand(time(0));
		while (1) {
			x=rand()%n+1,y=rand()%n+1,z=rand()%n+1;
			if (x==y||y==z||x==z) continue;
			if (query(x,y,z)<=(n-4)/6) break;
		}
		int now,mx=-1,p,p2;
		for (int i=1;i<=n;i++) g[i].clear();
		for (int i=1;i<=n;i++) {
			if (i==x||i==y) continue;
			now=query(x,y,i);
			g[now].push_back(i);
			mx=max(mx,now);
		}
		p=g[mx][0];
		if ((int)g[mx-1].size()>=2) {
			if (query(x,p,g[mx-1][0])>query(x,p,g[mx-1][1])) swap(g[mx-1][0],g[mx-1][1]);
		}
		p2=g[mx-1][0];
		a[p]=1,a[p2]=2;
		for (int i=1;i<=n;i++) if (i!=p&&i!=p2) {
			now=query(p,p2,i);
			a[i]=now+2;
		}
		if (a[1]>a[2]) for (int i=1;i<=n;i++) a[i]=n-a[i]+1;
		printf("! ");
		for (int i=1;i<=n;i++) printf("%d ",a[i]); puts("");
		fflush(stdout);
		//for (int i=1;i<=n;i++) assert(AA[i]==a[i]);
		//printf("cnt=%d\n",cnt);
		scanf("%d",&x);
	}
	
	
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Integer overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/