#include <bits/stdc++.h>
#define endl '\n'
typedef long long ll;
using namespace std;
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7;
const int N = 5e5 + 6;
void Solve() {
int n;
cin >> n;
int a[n];
for (int i = 0 ; i < n ; i++) a[i] = i + 1;
for (int i = 1 ; i < n ; i+=2) {
swap(a[i], a[i - 1]);
}
if(n%2)
swap(a[n - 1], a[n - 2]);
for (auto i : a)
cout << i << " ";
cout << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
//freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
int tt = 1, testcase = 1;
cin >> tt;
while (tt--) {
//cout<<"Case "<<testcase++<<": ";
Solve();
}
return 0;
}