#include <bits/stdc++.h>
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define ll long long
using namespace std;
int main()
{
    fast;
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;

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