#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl '\n'
#define debug cout<<"HERE"<<endl;
#define ff first
#define ss second
void edm()
{
ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
void solve()
{
int n;cin>>n;
if(n==3)
{
cout<<2<<" "<<1<<" "<<3<<endl;
return;
}
cout<<2<<" "<<1<<" ";
if(n%2==0)
{
for(int i=3;i<=n;i+=2)
{
cout<<i+1<<" "<<i<<" ";
}
cout<<endl;
return;
}
else
{
for(int i=3;i<n-2;i+=2)
{
cout<<i+1<<" "<<i<<" ";
}
cout<<n-1<<" "<<n<<" "<<n-2;
cout<<endl;
return;
}
cout<<endl;
}
signed main()
{
//edm();
int t = 1;
cin>>t;
for(int i=1;i<=t;i++)
{
///cout<<"Case "<<i<<": ";
solve();
}
}