#include <bits/stdc++.h>
#define hi cout<<"hi\n";
using namespace std;
#define ll long long
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define pb push_back
#define pb2 pop_back
#define ff first
#define ss second
#define debug(x) cout<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define IO ios_base::sync_with_stdio(0);cin.tie(NULL);
const char nl = '\n';

int main(){
    int t;cin>>t;
    while(t--){
        int n;cin>>n;
        if(n%2==0){
            for(int i=2;i<=n;i+=2){
                cout<<i<<" "<<i-1<<" ";
            }cout<<nl;
        }
        else{
            for(int i=1;i<=n-3;i+=2){
                cout<<i+1<<" "<<i<<" ";
            }
            cout<<n-1<<" "<<n<<" "<<n-2<<nl;
        }
    }
}
