#include <bits/stdc++.h>
using namespace std;
void print() {cout<<endl;}
template<typename T,typename... E>
void print(T t,E... e) {cout<<t<<(sizeof...(e)?" ":"");print(e...);}
#define forn(i,x,n) for(int i=int(x);i<int(n);++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        int v[n];
        iota(v, v+n, 1);
        forn(i, 0, n-1) {
            swap(v[i], v[i+1]);
            i++;
        }
        if (n&1) swap(v[n-1], v[n-3]);
        forn(i, 0, n) {
            cout << v[i] << " \n"[i+1==n];
        }
    }
}
