#include<bits/stdc++.h>
using namespace std;
/*#ifndef ONLINE_JUDGE
#include "DEBUG.h"
#define bug(...) __f (#__VA_ARGS__, __VA_ARGS__)
#endif*/
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define double long double
#define print(a) for(auto x : a) cout << x << " ";
#define printpair(a) for(auto x : a) cout << x.first << " " << x.second<<"\n";
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
void solve()
{
int n;
cin >> n;
if (n <= 4)
{
cout << "-1" << "\n";
return;
}
vector<int>v(n);
for (int i = 0; i < n; i++)
v[i] = i + 1;
int cnt = 1e5;
while (cnt--) {
bool f = 0;
for (int i = 0; i < n - 1; i++)
{
if (abs(v[i + 1] - v[i]) > 1 and __gcd(v[i + 1], v[i]) == 1)
;
else
{
f = 1;
break;
}
}
if (!f)
{
print(v);
cout << "\n";
return;
}
shuffle(v.begin(), v.end(), rnd);
}
cout << -1 << "\n";
}
int main()
{
first_in_out
int t = 1;
cin >> t;
while (t--)
solve();
}