#include<bits/stdc++.h>
using namespace std;

#define ll long long

int main() 
{
	ll t;

	cin>>t;

	while(t--)
	{
		ll n,i,j;
		cin>>n;

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