#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#include <utility>
#define ll long long
#define endl "\n"
using namespace std;
//struct cmp { bool operator()(const ll &a, const ll &b) const { return a < b; }};
//#define ordered_set tree<ll, null_type,cmp,rb_tree_tag, tree_order_statistics_node_update>
// st.find_by_order(index) gives the k-th smallest element (0-based index)
// st.order_of_key(x) gives the number of elements strictly less than x
#define sp(x) fixed << setprecision(x)
//int fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
//int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
// auto it = mp.find(x);if (it != mp.end())
//priority_queue<pair<ll, ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> pq;
//sort(vec.begin(), vec.end(),greater<int>());
//vector<bool> isPrime(limit + 1, true);
#define memo(a,b) memset(a,b,sizeof(a))
ll n;
bool used[2005];
vector<ll> res;
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;
}
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 (dfs(0)) {
for (auto x : res)cout<<x<<" ";
cout<<endl;
} else {
cout <<-1<< endl;
}
}
}