#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
#define memo(a,b) memset(a,b,sizeof(a))
ll n;
const ll N=2e3+5;
vector<ll> res;
bool used[N];
bool check(ll x, ll y) {
return __gcd(x, y) == 1 && abs(x - y) > 1;
}
bool dfs(ll len) {
if (len == n) return 1;
for (ll i = 1; i <= n; i++) {
if (used[i]) continue;
if (len == 0 || check(res[len - 1], i)) {
used[i] = 1;
res.push_back(i);
if (dfs(len + 1)) return 1;
res.pop_back();
used[i] = 0;
}
}
return 0;
}
bool isok(vector<ll> &v) {
for (ll i = 1; i < v.size(); i++) {
if (__gcd(v[i], v[i-1]) != 1 || abs(v[i] - v[i-1]) <= 1) return 0;
}
return 1;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int test; cin >> test;
while (test--) {
cin >> n;
res.clear(); memo(used, 0);
if (n <= 9) { //
if (dfs(0)) {
for (auto x : res) cout<<x<<" ";
cout << endl;
} else {
cout <<-1<<endl;
}
} else {
vector<ll> ans;
for (ll i = 2; i <= n; i += 2) ans.push_back(i);
for (ll i = n - (n % 2 == 0); i >= 1; i -= 2) ans.push_back(i);
if (isok(ans)) {
for (auto x : ans) cout <<x<<" ";
cout << endl;
} else cout <<-1<< endl;
}
}
}