#if __has_include("../stdc++.h")
#include "../stdc++.h"
#else
#include <bits/stdc++.h>
#endif
template <typename T>
std::istream &operator>>(std::istream &in, std::vector<T> &v)
{
for (T &x : v)
in >> x;
return in;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v)
{
for (std::size_t i = 0; i < v.size(); ++i)
out << v[i] << (i + 1 == v.size() ? "" : " ");
return out;
}
inline void yes() { std::cout << "Yes\n"; }
inline void no() { std::cout << "No\n"; }
using namespace std;
void solve()
{
int n;
cin >> n;
if (n == 3) {
cout << "2 3 1\n";
return;
}
for (int i = 1; i <= n; i+= 2) {
if (i == n - 2) {
cout << i << " " << n << " " << i + 1;
break;
}
else {
cout << i + 1<< " " << i << " ";
}
}
cout << '\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin >> t;
while (t--)
solve();
return 0;
}