#include <bits/stdc++.h>
#define pb push_back
#define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

using namespace std;
using ll = long long;

const ll INF = 1e18;
const unsigned int MOD = 1000000007;

void testcase();

int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1; 
  cin >> t;
  while (t--) {
    testcase();
//    cout << endl;
  }
  return 0;
}

void testcase() {
  int n;
  cin >> n;
  vector<int>a;
  rep(i,0,n){
    a.pb(i+1);
  }
  
  if (n%2==0) {
    for (int i = 0; i < n; i+=2){
      int temp=a[i];
      a[i]=a[i+1];
      a[i+1]=temp;
    }
  } else {
    a[0] = 3; a[1] = 1; a[2] = 2;
      for (int i = 3; i < n; i+=2){
      int temp=a[i];
      a[i]=a[i+1];
      a[i+1]=temp;
    }
  }
  rep(i,0,n) {
    cout << a[i] << " ";
  }
  cout << endl;
}
