import sys
def beautiful_permutation(N):
# impossible small cases
if N in (2, 3, 4, 6):
return []
if N == 1:
return [1]
if N == 5:
# one fixed base solution for N=5
return [5, 2, 4, 1, 3]
ans = []
# 1) all odd numbers >= 7
for x in range(7, N+1, 2):
ans.append(x)
# 2) the fixed seed [5,1,3]
ans.extend([5, 1, 3])
# 3) the small evens [2,4,6]
ans.extend([2, 4, 6])
# 4) all remaining evens >= 8
for x in range(8, N+1, 2):
ans.append(x)
return ans
def main():
data = sys.stdin.read().strip().split()
T = int(data[0])
idx = 1
out_lines = []
for _ in range(T):
N = int(data[idx]); idx += 1
perm = beautiful_permutation(N)
if not perm:
out_lines.append("-1")
else:
out_lines.append(" ".join(map(str, perm)))
sys.stdout.write("\n".join(out_lines))
if __name__ == "__main__":
main()