#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define pb push_back
#define all(x) x.begin(), x.end()
#define se second
#define fi first
ll MOD = 1e9 + 7;
ll INFMAX = 1e16, INFMIN = -1e18;
const ll N = 2e5 + 5;
void peace(ll tc)
{
  ll n;
  cin >> n;
  vector<ll> arr(n);
  for (ll i = 0; i < n; i++)
    arr[i] = i + 1;
  for (ll i = 1; i < n; i += 2)
  {
    swap(arr[i], arr[i - 1]);
  }
  if (n & 1)
    swap(arr[n - 1], arr[n - 2]);

  for (auto x : arr)
  {
    cout << x << " ";
  }
  cout << "\n";
}

int main()
{

  boost;
  ll t;
  t = 1;
  //----------
  cin >> t;
  //----------
  for (ll i = 1; i <= t; i++)
  {
    peace(i);
  }
  // ll T = clock();

  // cerr << "\n\nTIME: " << (double)(clock() - T) / CLOCKS_PER_SEC << " sec\n";
  // T = clock();
}
