#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);

    for (int i = 0; i < n; i++) {
        a[i] = i + 1;
    }

    if (n % 2 == 0) {
        for (int i = 0; i < n; i += 2) {
            swap(a[i], a[i + 1]);
        }
    }
    else {

        for (int i = 0; i < n - 3; i += 2) {
            swap(a[i], a[i + 1]);
        }

        swap(a[n - 3], a[n - 1]);
        swap(a[n - 1], a[n - 2]);
    }

    for (auto& x : a) {
        cout << x << ' ';
    }

    cout << endl;

}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);


    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}