#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define int                         long long
#define ld                          long double
#define pb                          push_back
#define eb                          emplace_back
#define ff                          first
#define ss                          second
#define loop(i,a,b)                 for(int i=a;i<b;i++)
#define rloop(i,a,b)                for(int i=a;i>=b;i--)
#define all(a)                      a.begin(), a.end()
#define sortv(a)                    sort(a.begin(),a.end())
#define inf   1e15
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int vis[1000001];

vector<int>adj[1000001];


bool sortcol(const vector<int>&v1 ,const vector<int>&v2)
{
    return v1[1]>v2[1];
}

void dfs(int node)
{
	vis[node]=1;

	for(int child:adj[node])
	{
		if(vis[child]==0)
			dfs(child);
	}	

	return ;
}

/*--------------------------- SOLUTION STARTS FROM HERE---------------------------*/

int solve()
{
    int n;
    cin>>n;
    if(n%2)
    {
        if(n==3)
        {
            cout<<3<<" "<<1<<" "<<2;
            return 0;
        }
        int i;
        for( i=1; i<n-3; i++)
        {
            cout<<i+1<<" "<<i<<" ",i++;
        }
        // i++;
        cout<<n<<" "<<i<<" "<<i+1;
    }else{
        if(n==2)
            cout<<2<<" "<<1;
        else{
            for(int i=1; i<n; i++)    
                cout<<i+1<<" "<<i<<" ",i++;
            
        }
    }
    return 0;
}

signed main()
{
  #ifndef ONLINE_JUDGE

       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif

    int t;
    
    cin>>t;
    
    while(t--)
    {
        solve();
        cout<<"\n";
    }
    
    return 0;
}