#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int N = 1e5 + 5;
const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;


int  powerMOD(int x,int  n)
{
    int res=1LL;
    while(n)
    {
        if(n&1)
        {
            res=(res*x)%MOD;
        }
        n>>=1;
        x=(x*x)%MOD;
    }
    return res;
}

void solve()
{   
    int n;
    cin>>n;
    
    vector<int> v(n+1);
    
    for(int i=1;i<=n;i++){
        v[i] = i;
    }
    
    for(int i=1;i<n;i+=2){
        swap(v[i] , v[i+1]);
    }
    
    if(n%2 == 1){
        swap(v[n] , v[n-1]);
    }
    
    for(int x=1;x<=n;x++){
        cout<<v[x]<<' ';
    }
    cout<<endl;
}

signed main()
{
   IOS;
   
   int t = 1;
   cin >> t;
   for (int i = 1; i <= t; i++)
   {
      //cout<<"Case #"<<i<<": ";
      solve();
   }
   return 0;
}