#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool check(vector<pair<ll,ll> >&v,ll n,ll mid){
	vector<pair<ll,ll> >tmp;
	ll cnt=0;
	ll i=0;
	while(i<v.size() and cnt<mid){
		if(cnt+v[i].ss<=mid){
			tmp.push_back({v[i].ss,v[i].ff});
			cnt+=v[i].ss;
		}else{
			ll val=mid-cnt;
			tmp.push_back({val,v[i].ff});
			cnt+=val;
		}
	}
	sort(tmp.rbegin(),tmp.rend());
}
int main(){
	io;
	ll t;
	cin>>t;
	while(t--){
		ll n;
		cin>>n;
		if(n%2==0){
			for(ll i=1;i+1<=n;i+=2){
				cout<<(i+1)<<" "<<i<<" ";
			}cout<<endl;
		}else{
			for(ll i=1;i+4<=n;i+=2){
				cout<<(i+1)<<" "<<i<<" ";
			}cout<<n<<" "<<(n-2)<<" "<<(n-1)<<endl;
		}
	}
	return 0;
}