#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> result;
vector<bool> used;
bool found = false;
bool isValid(int a, int b) {
return __gcd(a, b) == 1 && abs(a - b) > 1;
}
void dfs(vector<int>& path) {
if (found) return; // early exit
if (path.size() == n) {
result = path;
found = true;
return;
}
for (int i = 1; i <= n; ++i) {
if (!used[i]) {
if (!path.empty()) {
if (!isValid(path.back(), i)) continue;
}
used[i] = true;
path.push_back(i);
dfs(path);
path.pop_back();
used[i] = false;
}
}
}
void solve(int N) {
n = N;
result.clear();
used.assign(n + 1, false);
found = false;
vector<int> path;
dfs(path);
if (found) {
for (int x : result) cout << x << " ";
cout << endl;
} else {
cout << -1 << endl;
}
}
int main() {
int t;
cin >> t;
while (t--) {
int N;
cin >> N;
solve(N);
}
return 0;
}