//OH ME VEEEEEEENGO!!!!
#include <bits/stdc++.h>
using namespace std;

#define FAST_IO ios::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
#define sz(v) int(v.size())
#define pb push_back
#define ss second
#define ff first


typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

const ll mod = 1e9 + 7;

ll bp(ll a, ll n){
	ll ans=1;
	while(n>0){
		if(n&1) ans = (ans*a)%mod;
		a = (a*a)%mod;
		n>>=1;
	}
	return ans;
}

void solve(){
  int n;
  cin>>n;
  if(n%2){
    cout<<3<<" "<<1<<" "<<2<<" ";
    FOR(i,2,n/2+1){
      cout<<2*i+1<<" ";
      cout<<2*i<<" ";
    }
    cout<<'\n';
  }else{
    FOR(i,1,n/2+1){
      cout<<2*i<<" ";
      cout<<2*i-1<<" ";
    }
    cout<<'\n';
  }
  
}


int main(){
  FAST_IO;
  int tt=1;
  cin>>tt;
  while(tt--){
    solve();
  }
  return 0;
}
