#include<bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int Prime = 1e9+7;
const int Base = 251;
//...................................................................//
#define endl '\n'
#define Int long long int
#define gcd(x, y) (__gcd(x, y))
#define lcm(x, y) ((x/gcd(x, y))*y)
#define rand(x, y) rand()%(y-x+1)+x
#define pow2(x) (1<<x)
#define pi 3.141592653589793
#define decimal(x, y) fixed<<setprecision(x)<<y
#define unsync ios_base::sync_with_stdio(0); cin.tie(0);
#define TxtI freopen("input.txt","r",stdin);
#define TxtO freopen("output.txt","w",stdout);
//...................................................................//
int main()
{
//srand(time(0));
//TxtI TxtO
unsync
int t;
cin >> t;
while(t--)
{
Int n;
vector<Int> vec;
cin >> n;
for(int i=1; i<=n/2; i++)
{
vec.push_back(2*i);
vec.push_back(2*i-1);
}
if(n%2)
{
vec.push_back(n);
swap(vec[n-1], vec[n-2]);
}
for(int i=0; i<vec.size(); i++) cout << vec[i] << ' ';
cout << endl;
}
}