#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<long long> vll;
#define endl '\n'
#define pb push_back
#define fast   ios_base::sync_with_stdio(false); cin.tie(NULL);


void solve(){


	int n; cin >> n;
	vi v(n);
	for(int i = 0 ; i <n ;i++) v[i] = i+1;
 
    if(n % 2 == 0){
    	for(int i = 0 ; i < n-1 ; i += 2){
    		swap(v[i],v[i+1]);
    	}
    }
    else{
    	for(int i = 0 ; i < n-2;i+=2){
    		swap(v[i],v[i+1]);
    	}
    	swap(v[n-1],v[n-2]);
    }
    for(int x : v) cout<<x<<" ";	
	


	
}

int main(){
	fast
	int t; cin>>t;
	while(t--){
		solve();
		cout<<endl;
	}
}