#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=10010;
int e[N];
int t,n;
bool b[N];
int main(){
	scanf("%d",&t);
	while(t--){
		int flag=0;
		scanf("%d",&n);
		if(n&1)flag=1;;
		for(int i=1;i<=n;i+=2){
			if(i+1>n)break;
			printf("? 2 %d %d 1\n",i,i+1);fflush(stdout);
			int x;
			scanf("%d",&x);
			if(x==1){
				e[i]=1;
				printf("? 1 %d %d %d\n",i,i+1,n-1);fflush(stdout);
				int b;
				scanf("%d",&b);
				if(b!=n-1){
					e[i+1]=b;
				}
				else{
				printf("? 1 %d %d %d\n",i+1,i,n-1);fflush(stdout);
				scanf("%d",&b);
					e[i+1]=b;
				}
				continue;
			}
			if(x==2){
				printf("? 2 %d %d 1\n",i+1,i);fflush(stdout);
				int a;
				scanf("%d",&a);
				if(a==1){
				e[i+1]=1;
				printf("? 1 %d %d %d\n",i+1,i,n-1);fflush(stdout);
				int b;
				scanf("%d",&b);
				if(b!=n-1){
					e[i]=b;
				}
				else{
					printf("? 1 %d %d %d\n",i,i+1,n-1);fflush(stdout);
					scanf("%d",&b);
					e[i]=b;
					
				}
				continue;
				}
			}
				printf("? 1 %d %d %d\n",i,i+1,n-1);fflush(stdout);
				int y;
				scanf("%d",&y);
				if(y==n){
					e[i+1]=y;
					e[i]=x;
					continue;
				}
				if(y==n-1){
					printf("? 1 %d %d %d\n",i+1,i,n-1);fflush(stdout);
					int b;
					scanf("%d",&b);
					if(b==n){
					e[i]=b;
					e[i+1]=x;
					continue;
					}
				}
					printf("? 2 %d %d %d\n",i,i+1,x);fflush(stdout);
					int z;
					scanf("%d",&z);
					if(x==z){
						e[i]=x;
						e[i+1]=y;
					}
					else{
						e[i]=y;
						e[i+1]=x;
					}
		}
		if(flag){
		memset(b,0,sizeof(b));
		for(int i=1;i<n;i++){
			b[e[i]]=1;
		}
		int i=1;
		for(i;i<=n+1;i++)if(!b[i])break;
		e[n]=i;
		}
		printf("! ");
		for(int i=1;i<=n;i++)printf("%d ",e[i]);
		printf("\n");
		fflush(stdout);
	}
	return 0;
} 
/*
1
4
2
1
3
3
2
2
3
4
*/