/* GREEN UNIVERSITY OF BANGLADESH
Md DinIslam, Batch-221 (CSE)
*/
#include <bits/stdc++.h>
using namespace std;
// Debug..
#ifdef LOCAL
#include "debug.h"
#else
#define dg(x...)
#endif
#define ll long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define sz(x) int(x.size())
#define arr array
void Din() {
int n;
cin >> n;
if (n == 3) {
cout << "2 3 1\n";
return;
}
cout << "2 ";
for (int i = 1; i <= n; ++i) {
if (i != 2) {
cout << i << " ";
}
}
cout << '\n';
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int t = 1;
cin >> t;
for (int i = 1; i <= t; ++i) {
// cout << "Case " << i << ": ";
Din();
}
return 0;
}