// #include<bits/stdc++.h>
// using namespace std;
// #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// #define endl '\n'
// #define ll long long
// #define test_case int t;cin>>t;while(t--)
// int main(){
// Faster;
// }
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
bool isValid(int a, int b) {
return __gcd(a, b) == 1 && abs(a - b) > 1;
}
bool dfs(vector<int>& arr, vector<bool>& used, int n) {
if ((int)arr.size() == n) return true;
for (int i = 1; i <= n; i++) {
if (!used[i]) {
if (arr.empty() || isValid(arr.back(), i)) {
arr.push_back(i);
used[i] = true;
if (dfs(arr, used, n)) return true;
arr.pop_back();
used[i] = false;
}
}
}
return false;
}
void solve(int n) {
vector<int> arr;
vector<bool> used(n + 1, false);
if (dfs(arr, used, n)) {
for (int x : arr) cout << x << " ";
cout << endl;
} else {
cout << -1 << endl;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int T; cin >> T;
while (T--) {
int n;
cin >> n;
solve(n);
}
return 0;
}