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


int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		vector<ll> v(n+5);
		if(n%2==0)
		{
			for(int i=1;i<n;i+=2)
			{
				v[i+1]=i;
				v[i]=i+1;
			}
		}
		else
		{
			ll rem;
			rem=n-3;
			v[1]=3;
			v[2]=1;
			v[3]=2;
			if(rem>0)
			{
				for(int i=4;i<n;i+=2)
				{
					v[i+1]=i;
				    v[i]=i+1;
				}
			}
		}
		for(int i=1;i<=n;i++)
		   cout<<v[i]<<" ";	
		cout<<endl;
	}
	return 0;
}