#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long int
int32_t main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("op9.txt", "w", stdout);
#endif

    int tt; cin >> tt;
    while (tt--) {
        int n; cin >> n;
        if (n % 2 == 0) {
            for (int i = 1; i <= n; i ++) {
                int ans  = i;
                if (i % 2 != 0) {
                    cout << ++ans << " ";
                } else {
                    cout << --ans << " ";
                }
            }

            cout << endl;
        } else {

            for (int i = 1; i <= n - 3; i++) {
                int ans = i;
                if (i % 2 != 0) {
                    cout << ++ans << " ";
                } else {
                    cout << --ans << " ";
                }
            }

            cout << n << " ";
            cout << n - 2 << " " << n - 1 << endl;

        }

    }
}




