#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define t5 100005
#define inf 100000000000000000
ll ask(ll t,ll i,ll j , ll x){
	cout <<"? "<< t << " " << i << " " << j << " " << x << endl;
	ll temp;
	cin >> temp;
	return temp;
}
void solve(){
	ll n;
	cin>> n;
	ll pos = 0;
	for(ll i=1	;		i<n	;	i+=2){
		ll q;
		q = ask(2,i,i+1,1);
		if(q == 1){
			pos = i;
			break;
		}
		else if(q == 2){
			q = ask(2,i+1,i,1);
			if(q == 1){
				pos = i+1;
				break;
			}
		}
	}
	if(!pos)
		pos = n;
	vector <ll> v(n+1);
	for(ll i=1	;	i<=n	;	i++){
		if(i==pos){
			v[i] = 1;
		}
		else{
			ll q = ask(1,pos,i,n-1);
			v[i] = q;
		}
	}
	cout <<"!";
	for(ll i=1	;	i<=n	;	i++){
		cout <<" " << v[i];
	}
	cout << endl;
}
int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	ll t;
	cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}
