#include <iostream>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main()
{   
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int tests=1;
    cin>>tests;
    while(tests--)
    {
        int n;
        cin>>n;
        if(n%2==0){
            for(int i=1;i<=(n-1);i+=2){
                cout<<i+1<<" "<<i<<" ";
            }
        }
        else{
            
            int a[n];
            int k=0;
            for(int i=1;i<=(n-2);i+=2){
                a[k]=i+1;
                k++;
                a[k]=i;
                k++;
            }
            a[k]=n;
            swap(a[n-1],a[n-2]);
            for(int i=0;i<n;i++) cout<<a[i]<<" ";
            
        }
        cout<<endl;
    }

    return 0;
}