A permutation of length $n$ is an array $p=[p_1,p_2,\dots,p_n]$, which contains every integer from $1$ to $n$ (inclusive) and, moreover, each number appears exactly once. For example, $p=[3,1,4,2,5]$ is a permutation of length $5$.

For a given number $n$ ($n \ge 2$), find a permutation $p$ in which absolute difference (that is, the absolute value of difference) of any two neighboring (adjacent) elements is between $2$ and $4$, inclusive. Formally, find such permutation $p$ that $2 \le |p_i - p_{i+1}| \le 4$ for each $i$ ($1 \le i < n$).

Print any such permutation for the given integer $n$ or determine that it does not exist.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 100$) — the number of test cases in the input. Then $t$ test cases follow.

Each test case is described by a single line containing an integer $n$ ($2 \le n \le 1000$).


-----Output-----

Print $t$ lines. Print a permutation that meets the given requirements. If there are several such permutations, then print any of them. If no such permutation exists, print -1.


-----Example-----
Input
6
10
2
4
6
7
13

Output
9 6 10 8 4 7 3 1 5 2 
-1
3 1 4 2 
5 3 6 2 4 1 
5 1 3 6 2 4 7 
13 9 7 11 8 4 1 3 5 2 6 10 12

Difficulty: MEDIUM_HARD
Tags: Constructive algorithms

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1, end='')
	else:
		for i in range(n - (1 - n % 2), 0, -2):
			print(i, end=' ')
		print(4, end=' ')
		for j in range(2, n + 1, 2):
			if j == 4:
				continue
			print(j, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	l = []
	if n < 4:
		print(-1)
	else:
		for i in range(n + 1):
			if i % 2 == 1:
				l.insert(0, i)
		l.append(4)
		l.append(2)
		if n > 5:
			for i in range(6, n + 1):
				if i % 2 == 0:
					l.append(i)
		print(*l)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
p6 = [0, 3, 1, 5, 2, 4]
p7 = [4, 0, 2, 5, 1, 3, 6]
p4 = [1, 3, 0, 2]
t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		next_ = 1
		if n % 4 == 1:
			sys.stdout.write(str(next_) + ' ')
			next_ += 1
			n -= 1
		elif n % 4 == 2:
			for i in range(6):
				sys.stdout.write(str(next_ + p6[i]) + ' ')
			next_ = 7
			n -= 6
		elif n % 4 == 3:
			for i in range(7):
				sys.stdout.write(str(next_ + p7[i]) + ' ')
			next_ = 8
			n -= 7
		while n > 0:
			for i in range(4):
				sys.stdout.write(str(next_ + p4[i]) + ' ')
			next_ += 4
			n -= 4
		sys.stdout.write('\n')


t = int(input())
e = []
o = []
ans = ''
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		for i in range(1, n + 1):
			if i % 2 == 0 and (i != 2 and i != 4):
				e.append(i)
			elif i != 2 and i != 4:
				o.append(i)
		for c in o[::-1]:
			ans += str(c) + ' '
		ans += '4 2 '
		for c in e:
			ans += str(c) + ' '
		print(ans)
	e = []
	o = []
	ans = ''


per = ([2, 4, 1, 3], [2, 4, 1, 3, 5], [2, 5, 1, 3, 6, 4], [2, 6, 3, 1, 4, 7, 5])
for tc in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ans = []
	while n >= 8:
		n -= 4
		ans.extend([i + len(ans) for i in per[0]])
	ans.extend([i + len(ans) for i in per[n - 4]])
	print(*ans)


from sys import stdin
from collections import Counter
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		n = int(input())
		flag = False
		l = []
		if n < 4:
			flag = False
		else:
			flag = True
			e = n - 1
			o = n
			if n % 2 == 0:
				e = n
				o = n - 1
			for i in range(e, 5, -2):
				l.append(i)
			l.append(2)
			l.append(4)
			for i in range(1, o + 1, +2):
				l.append(i)
		if flag:
			for i in l:
				print(i, end=' ')
			print()
		else:
			print(-1)
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n < 4:
		print(-1)
		continue
	x = []
	y = []
	for i in range(1, n + 1, 2):
		y.append(i)
	for i in range(2, n + 1, 2):
		x.append(i)
	x.reverse()
	if n % 2:
		(x[0], x[1]) = (x[1], x[0])
	else:
		n = len(y)
		(y[n - 1], y[n - 2]) = (y[n - 2], y[n - 1])
	for item in y:
		print(item, end=' ')
	for item in x:
		print(item, end=' ')
	print('')


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		for i in range(n, 0, -1):
			if i % 2 == 1:
				print(i, end=' ')
		print(4, 2, end=' ')
		for i in range(6, n + 1, 2):
			print(i, end=' ')
		print()


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	if n == 1:
		print(1)
		continue
	if n < 4:
		print(-1)
		continue
	output = []
	if n % 2 == 0:
		start = 2
	else:
		start = 1
	for i in range(start, n + 1, 2):
		output.append(str(i))
	output.append(str(n - 3))
	output.append(str(n - 1))
	for i in range(n - 5, 0, -2):
		output.append(str(i))
	print(' '.join(output))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		ans = '3 1 4 2'
		if n == 4:
			print(ans)
		else:
			for i in range(4, n + 1):
				if i % 2 == 1:
					ans = str(i) + ' ' + ans
			for i in range(5, n + 1):
				if i % 2 == 0:
					ans = ans + ' ' + str(i)
			print(ans)


import sys
import math
t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	if n <= 3:
		print(-1)
	elif n == 4:
		print(*[3, 1, 4, 2])
	else:
		for i in range(1, n + 1, 2):
			ans.append(i)
		ans.append(ans[-1] - 3)
		pq = ans[-1]
		for i in range(n // 2 * 2, 0, -2):
			if i != pq:
				ans.append(i)
		ans = ' '.join(map(str, ans))
		sys.stdout.write(ans + '\n')


T = int(input())
for i in range(T):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		L = [str(x) for x in range(1, n + 1)]
		a = L[1::2]
		if n > 5:
			if n & 1 == 0:
				b = [L[-4], L[-2]]
				b.extend(L[-6::-2])
			else:
				b = [L[-5], L[-1], L[-3]]
				b.extend(L[-7::-2])
		else:
			b = L[0::2]
		print(' '.join(a + b))


for t in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	arr = []
	if n % 2 == 0:
		arr = [i for i in range(2, n + 1, 2)]
	else:
		arr = [i for i in range(1, n + 1, 2)]
	arr.append(n - 3)
	arr.append(n - 1)
	for i in range(n - 5, 0, -2):
		arr.append(i)
	print(*arr)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		lst = []
		for i in range(n, 0, -1):
			if i % 2 != 0:
				lst.append(i)
		lst.append(4)
		lst.append(2)
		for i in range(6, n + 1):
			if i % 2 == 0:
				lst.append(i)
		print(*lst)


import queue

def permutation():
	t = int(input())
	for i in range(0, t):
		num = int(input())
		if num < 4:
			print('-1')
		else:
			plist = list()
			odds = list()
			evens = queue.Queue()
			for j in range(1, num + 1):
				if j % 2 == 0:
					if j == 2:
						evens.put(4)
					elif j == 4:
						evens.put(2)
					else:
						evens.put(j)
				else:
					odds.append(j)
			while len(odds) > 0:
				plist.append(odds.pop())
			while not evens.empty():
				plist.append(evens.get())
			for e in plist:
				print(e, end=' ')
permutation()


for _ in range(int(input())):
	num = int(input())
	if num < 4:
		print(-1)
	else:
		odd = []
		even = []
		for i in range(1, num + 1):
			if i % 2 == 0 and i != 2 and (i != 4):
				even.append(i)
			elif i != 4 and i != 2:
				odd.append(i)
		odd = odd[::-1]
		ans = []
		for ele in odd:
			ans.append(ele)
		ans.append(4)
		ans.append(2)
		for ele in even:
			ans.append(ele)
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	s = [3, 1, 4, 2]
	p = []
	if n == 4:
		print(*s)
	elif n > 4:
		for i in range(5, n + 1):
			if i % 2 == 0:
				s.append(i)
			else:
				r = [i]
				s = r + s
		print(*s)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	l = [2, 4, 1, 3]
	if n <= 3:
		print(-1)
	else:
		p = 1
		for i in range(5, n + 1):
			if p == 1:
				l.append(i)
			if p == -1:
				l = [i] + l
			p *= -1
		print(*l)


def printer(lst):
	print(' '.join(lst))
t = int(input())
for i in range(t):
	base = ['3', '1', '4', '2']
	n = int(input())
	check = 0
	if n <= 3:
		print(-1)
	else:
		for x in range(5, n + 1):
			if check == 0:
				check = 1
				base.append(str(x))
			else:
				check = 0
				base.insert(0, str(x))
		printer(base)


t = int(input())
import math

def solve(n):
	if n < 4:
		return -1
	if n == 4:
		return ' '.join([str(x) for x in [2, 4, 1, 3]])
	else:
		first = [str(x) for x in range(1, int(math.ceil(n + 1)), 2)]
		second = [str(x) for x in range(2, int(n) + 1, 2)]
		second.reverse()
		if n % 2 == 1:
			k = second[0]
			second[0] = second[1]
			second[1] = k
		else:
			(a, b, c) = (second[0], second[1], second[2])
			second[0] = c
			second[1] = a
			second[2] = b
		return ' '.join(first + second)
for _ in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 2 == 0:
		a = n
		b = 1
	else:
		a = n - 1
		b = 1
	if n <= 3:
		print(-1, end=' ')
	if n >= 4:
		while a > 4:
			print(a, end=' ')
			a -= 2
		print('2', '4', end=' ')
		while b <= n:
			print(b, end=' ')
			b += 2
	print(end='\n')


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import deque
for case in range(itg()):
	n = itg()
	if n <= 3:
		print(-1)
		continue
	ans = deque([2, 4])
	for i in range(6, n + 1, 2):
		ans.appendleft(i)
	for i in range(1, n + 1, 2):
		ans.append(i)
	print(*ans)


from queue import deque
t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		ans = []
		start = 1 if n % 2 == 1 else 2
		for i in range(start, n + 1, 2):
			ans.append(i)
		ans.extend([i - 3, i - 1])
		for j in range(i - 5, 0, -2):
			ans.append(j)
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	if n > 3:
		a = []
		for i in range(1, n + 1, 4):
			a += [i + 1] + [i + 3] + [i] + [i + 2]
		a = a[:n - n % 4]
		if n % 4 == 1:
			a += [i]
		if n % 4 == 2:
			a = a[:-1] + [i] + [i - 2] + [i + 1]
		if n % 4 == 3:
			a = a[:-1] + [i] + [i + 2] + [i - 2] + [i + 1]
		print(*a)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	start = [3, 1, 4, 2]
	j = 4
	if n < 4:
		print(-1)
	else:
		for i in range(5, n + 1):
			if i - start[j - 1] <= 4 and i - start[j - 1] >= 2:
				start.append(i)
			else:
				temp = j - 2
				while temp >= 1:
					if i - start[temp] <= 4 and i - start[temp] >= 2 and (i - start[temp + 1] <= 4) and (i - start[temp + 1] >= 2):
						break
					temp -= 1
				start.insert(temp + 1, i)
			j += 1
		for i in start:
			print(i, end=' ')
		print('')


t = list(range(1001))
(t[2], t[4]) = (4, 2)
for _ in range(int(input())):
	n = int(input()) + 1
	print(*([-1] if 2 < n < 5 else t[2:n:2][::-1] + t[1:n:2]))


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		p = []
		if n % 2 == 0:
			for i in range(2, n + 1, 2):
				p.append(i)
		else:
			for i in range(1, n + 1, 2):
				p.append(i)
		p.append(n - 3)
		p.append(n - 1)
		for i in range(n - 5, 0, -2):
			p.append(i)
		print(' '.join(map(str, p)))


a = int(input())
for _ in range(a):
	x = int(input())
	li = []
	if x < 4:
		print(-1)
		continue
	b = x
	if x % 2 == 0:
		b = x - 1
	for i in range(b, 0, -2):
		li.append(i)
	li.append(4)
	li.append(2)
	for i in range(6, x + 1, 2):
		li.append(i)
	print(' '.join(map(str, li)))


t = int(input())
while t:
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		o = []
		e = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				e.append(i)
			else:
				o.append(i)
		if abs(o[-1] - e[-2]) < 2:
			o.append(e[-3])
			o.append(e[-1])
			o.append(e[-2])
			for i in range(len(e) - 4, -1, -1):
				o.append(e[i])
		else:
			o.append(e[-2])
			o.append(e[-1])
			for i in range(len(e) - 3, -1, -1):
				o.append(e[i])
		s = ''
		for i in o:
			s += str(i) + ' '
		print(s)
	t -= 1


T = int(input())
for _ in range(0, T):
	N = int(input())
	alist = []
	if N < 4:
		print(-1)
		continue
	elif N == 4:
		print('3 1 4 2')
		continue
	elif N == 5:
		print('1 3 5 2 4')
		continue
	elif N == 6:
		print('1 3 5 2 4 6')
		continue
	elif N == 7:
		print('1 3 5 7 4 6 2')
		continue
	idx = 1
	alist.append(idx)
	while 1:
		idx += 2
		alist.append(idx)
		if idx >= N - 1:
			break
	if N - idx == 1:
		idx -= 3
		alist.append(idx)
		idx += 4
		alist.append(idx)
		idx -= 2
		alist.append(idx)
		idx -= 4
		alist.append(idx)
		while 1:
			if idx == 2:
				break
			idx -= 2
			alist.append(idx)
	elif N - idx == 0:
		idx -= 3
		alist.append(idx)
		idx += 2
		alist.append(idx)
		idx -= 4
		alist.append(idx)
		while 1:
			if idx == 2:
				break
			idx -= 2
			alist.append(idx)
	for i in alist:
		print(i, end=' ')
	print()


from sys import stdin
a = int(stdin.readline())
for bb in range(0, a):
	c = int(stdin.readline())
	if c == 2 or c == 3:
		print(-1)
		continue
	if c == 4:
		print(3, end=' ')
		print(1, end=' ')
		print(4, end=' ')
		print(2)
		continue
	count = 0
	mark = 0
	if c % 2 == 0:
		while count < c:
			count += 2
			mark += 1
			print(count, end=' ')
		count -= 3
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		count += 2
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		count -= 4
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		while mark < c:
			count -= 2
			mark += 1
			if mark == c:
				print(count)
			else:
				print(count, end=' ')
	count = -1
	if c % 2 == 1:
		while count < c:
			count += 2
			mark += 1
			print(count, end=' ')
		count -= 3
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		count += 2
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		count -= 4
		mark += 1
		if mark == c:
			print(count)
			continue
		else:
			print(count, end=' ')
		while mark < c:
			count -= 2
			mark += 1
			if mark == c:
				print(count)
			else:
				print(count, end=' ')


for _ in range(int(input())):
	n = int(input())
	print(*[[*range(n - n % 2, 4, -2), 2, 4, *range(1, n + 1, 2)], [-1]][n < 4])


def run():
	N = int(input())
	if N == 2 or N == 3:
		print('-1')
		return
	space = False
	while N >= 5:
		if N - 5 == 2 or N - 5 == 3:
			break
		if space:
			print(' ', end='')
		space = True
		print('{} {} {} {} {}'.format(N, N - 3, N - 1, N - 4, N - 2), end='')
		N -= 5
	if N == 0:
		print('')
	elif N == 1:
		if space:
			print(' ', end='')
		space = True
		print('1')
	elif N == 2:
		pass
	elif N == 3:
		pass
	elif N == 4:
		if space:
			print(' ', end='')
		space = True
		print('3 1 4 2')
	elif N == 7:
		if space:
			print(' ', end='')
		space = True
		print('7 4 2 6 3 1 5')
	elif N == 8:
		if space:
			print(' ', end='')
		space = True
		print('8 5 7 3 1 4 6 2')
T = int(input())
for i in range(T):
	run()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	a = [3, 1, 4, 2]
	p = 0
	for i in range(5, n + 1):
		if p == 1:
			a = [i] + a
			p = 0
		else:
			a = a + [i]
			p = 1
	print(*a)


t = int(input())
while t > 0:
	n = int(input())
	if n < 4:
		print(-1)
	else:
		for i in range(n, 0, -1):
			if i % 2 == 1:
				print(i, end=' ')
		print(4, end=' ')
		print(2, end=' ')
		if n >= 6:
			for i in range(6, n + 1, 2):
				print(i, end=' ')
	t -= 1


t = int(input())
for w in range(t):
	n = int(input())
	l = []
	if n <= 3:
		print(-1)
	else:
		if n % 2 == 1:
			i = n
		else:
			i = n - 1
		while i >= 1:
			l.append(i)
			i -= 2
		for i in [4, 2, 6]:
			if i <= n:
				l.append(i)
		while i + 2 <= n:
			i += 2
			l.append(i)
		print(*l)


def check(n):
	arr = []
	if n % 2 == 1:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
	else:
		for i in range(2, n + 1, 2):
			print(i, end=' ')
	print(n - 3, end=' ')
	print(n - 1, end=' ')
	for i in range(n - 5, 0, -2):
		print(i, end=' ')
	print()
t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		check(n)


t = int(input())
while t:
	t -= 1
	v = list(map(int, input().strip().split()))[:1]
	ans = []
	if v[0] < 4:
		print('-1')
		continue
	x = v[0] if v[0] % 2 == 1 else v[0] - 1
	while x >= 1:
		print(x, end=' ')
		x -= 2
	print('4 2 ', end='')
	x = 6
	while x <= v[0]:
		print(x, end=' ')
		x += 2
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		wow = [2, 4, 1, 3]
		for i in range(5, n + 1):
			if i % 2 == 1:
				wow.append(i)
			else:
				wow = [i] + wow
		print(*wow)


from collections import *
from heapq import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	if n < 4:
		p = [-1]
	else:
		odd = list(range(1, n + 1, 2))
		even = list(range(6, n + 1, 2))
		p = odd[::-1] + [4, 2] + even
	print(*p)


for i in range(0, int(input())):
	largo = int(input())
	if largo < 4:
		print(-1)
	elif largo == 4:
		lista = [3, 1, 4, 2]
		print(*lista)
	elif largo == 5:
		lista = [3, 1, 4, 2, 5]
		print(*lista)
	else:
		lista = []
		len = largo
		bajo = 6
		if largo % 2 == 1:
			while len > 0:
				lista.append(len)
				len -= 2
			lista.append(4)
			lista.append(2)
			while bajo < largo:
				lista.append(bajo)
				bajo += 2
			print(*lista)
		else:
			while len > 1:
				lista.append(len - 1)
				len -= 2
			lista.append(4)
			lista.append(2)
			while bajo < largo + 1:
				lista.append(bajo)
				bajo += 2
			print(*lista)


t = int(input())
for i in range(t):
	n = int(input())
	even = [3, 1, 4, 2]
	odd = [5, 3, 1, 4, 2]
	if n == 2 or n == 3:
		print(-1)
	elif n % 2 == 0:
		listlen = int((n - 4) / 2)
		lisf = [n - i for i in range(0, 2 * listlen, 2)]
		lise = [n - i - 1 for i in range(0, 2 * listlen, 2)]
		for i in range(len(lisf)):
			print(lisf[i], end=' ')
		for i in range(len(even)):
			print(even[i], end=' ')
		for i in range(len(lise) - 1, -1, -1):
			print(lise[i], end=' ')
	else:
		listlen = (n - 5) / 2
		listlen = int((n - 4) / 2)
		lisf = [n - i for i in range(0, 2 * listlen, 2)]
		lise = [n - i - 1 for i in range(0, 2 * listlen, 2)]
		for i in range(len(lisf)):
			print(lisf[i], end=' ')
		for i in range(len(odd)):
			print(odd[i], end=' ')
		for i in range(len(lise) - 1, -1, -1):
			print(lise[i], end=' ')
	print()


for _ in range(int(input())):
	a = int(input())
	v = []
	if a > 3:
		t = 0
		if a % 2 == 0:
			t = 2
			a -= 1
		for i in range(a, 0, -2):
			v.append(i)
		v.append(4)
		v.append(2)
		for i in range(6, a + t, 2):
			v.append(i)
		print(*v)
	else:
		print(-1)


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	p = n // 2 * 2
	if n == 2 or n == 3:
		print(-1)
		continue
	if n == 1:
		print(1)
		continue
	while p != 4:
		print(p, end=' ')
		p -= 2
	print(2, 4, end=' ')
	if n <= 2:
		print(1)
		continue
	if n != 1:
		print(1, 3, end=' ')
		c = 5
		while c <= n:
			print(c, end=' ')
			c += 2
		print()


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ans = []
	ans.append(1)
	ans.append(4)
	for i in range(2, n + 1):
		if i == 4:
			continue
		elif i % 2 == 1:
			ans.insert(0, i)
		else:
			ans.append(i)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	ar = []
	kek = set()
	for i in range(1, n + 1):
		kek.add(i)
	kek.discard(n - 1)
	ar.append(n - 1)
	for i in range(n):
		if ar[-1] - 3 in kek:
			kek.discard(ar[-1] - 3)
			ar.append(ar[-1] - 3)
		elif ar[-1] - 2 in kek:
			kek.discard(ar[-1] - 2)
			ar.append(ar[-1] - 2)
		elif ar[-1] - 4 in kek:
			kek.discard(ar[-1] - 4)
			ar.append(ar[-1] - 4)
		elif ar[-1] + 3 in kek:
			kek.discard(ar[-1] + 3)
			ar.append(ar[-1] + 3)
		elif ar[-1] + 2 in kek:
			kek.discard(ar[-1] + 2)
			ar.append(ar[-1] + 2)
		elif ar[-1] + 4 in kek:
			kek.discard(ar[-1] + 4)
			ar.append(ar[-1] + 4)
	if n == 2 or n == 3 or n == 1:
		print(-1)
	else:
		print(*ar)


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	if n < 4:
		print(-1)
		return
	for i in range(n, -1, -1):
		if i & 1:
			print(i, end=' ')
	print(4, end=' ')
	print(2, end=' ')
	for i in range(6, n + 1):
		if not i & 1:
			print(i, end=' ')
	print()
for _ in range(iinp()):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	r = []
	if n >= 4:
		for i in range(1, n + 1):
			if i % 2 != 0:
				l.append(i)
			else:
				r.append(i)
		l.reverse()
		(r[0], r[1]) = (r[1], r[0])
		for i in range(len(l)):
			print(l[i], end=' ')
		for i in range(len(r)):
			print(r[i], end=' ')
		print()
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	lst1 = []
	lst2 = []
	if n < 4:
		print('-1')
		continue
	even_list = []
	for i in range(2, n + 1, 2):
		even_list.append(i)
	odd_list = []
	for i in range(1, n + 1, 2):
		odd_list.append(i)
	odd_list.reverse()
	if n // 2 * 2 == n:
		(odd_list[0], odd_list[1]) = (odd_list[1], odd_list[0])
	else:
		(even_list[len(even_list) - 1], even_list[len(even_list) - 2]) = (even_list[len(even_list) - 2], even_list[len(even_list) - 1])
	for num in even_list:
		print(num, end=' ')
	for num in odd_list:
		print(num, end=' ')
	print('')


t = int(input())
for _ in range(t):
	n = int(input())
	if n in [2, 3]:
		print(-1)
		continue
	a = []
	cur = 1
	while n >= 8:
		for x in [1, 3, 0, 2]:
			a += [x + cur]
		cur += 4
		n -= 4
	for x in {4: [1, 3, 0, 2], 5: [0, 2, 4, 1, 3], 6: [2, 0, 3, 5, 1, 4], 7: [2, 0, 3, 5, 1, 4, 6]}[n]:
		a += [x + cur]
	print(*a)


for nt in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	if n % 2:
		for i in range(1, n - 3, 2):
			print(i, end=' ')
		print(i + 3, i + 1, i + 4, i + 2, end=' ')
		for j in range(i - 1, 0, -2):
			print(j, end=' ')
		print()
	else:
		for i in range(2, n - 3, 2):
			print(i, end=' ')
		print(i + 3, i + 1, i + 4, i + 2, end=' ')
		for j in range(i - 1, 0, -2):
			print(j, end=' ')
		print()


def solve():
	n = int(input())
	i = 0
	a = [0] * n
	if n < 4:
		print(-1)
		return
	elif n == 4:
		print(3, 1, 4, 2)
		return
	while i + 4 < n:
		(a[i], a[i + 1], a[i + 2], a[i + 3], a[i + 4]) = (i + 1, i + 3, i + 5, i + 2, i + 4)
		i += 5
	if n % 5 == 4:
		(a[i], a[i + 1], a[i + 2], a[i + 3]) = (i + 3, i + 1, i + 4, i + 2)
	elif n % 5 == 3:
		(a[i - 1], a[i], a[i + 1], a[i + 2]) = (i + 1, i + 3, i - 1, i + 2)
	elif n % 5 == 2:
		(a[i - 1], a[i], a[i + 1]) = (i + 1, i - 1, i + 2)
	elif n % 5 == 1:
		a[i] = i + 1
	print(' '.join((str(x) for x in a)))

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print('-1')
	elif n % 2 == 0:
		for i in range(n, 4, -2):
			print(i, end=' ')
		print('2 4 ', end='')
		for i in range(1, n, 2):
			print(i, end=' ')
		print()
	else:
		for i in range(n - 1, 4, -2):
			print(i, end=' ')
		print('2 4 ', end='')
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n % 2 == 0:
		odds = [j for j in range(1, n, 2)]
		nums = [j for j in range(2, n + 1, 2)]
		nums.append(odds.pop(-2))
		odds.reverse()
		nums.extend(odds)
		print(' '.join((str(num) for num in nums)))
	elif n % 2 == 1:
		odds = [j for j in range(1, n + 1, 2)]
		nums = [j for j in range(2, n, 2)]
		nums.append(odds.pop(-3))
		odds.reverse()
		nums.extend(odds)
		print(' '.join((str(num) for num in nums)))


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	elif n == 4:
		print('3 1 4 2')
		continue
	odd = []
	even = []
	for i in range(1, n + 1):
		if i & 1:
			odd.append(i)
		else:
			even.append(i)
	ans = []
	odd.sort()
	even.sort()
	if n & 1:
		for i in range(n // 2 + 1):
			ans.append(odd.pop(-1))
		ans.append(4)
		for i in range(len(even)):
			if even[i] == 4:
				continue
			ans.append(even[i])
	else:
		for i in range(n // 2):
			ans.append(even.pop(-1))
		ans.append(5)
		for i in range(len(odd)):
			if odd[i] == 5:
				continue
			ans.append(odd[i])
	print(*ans)


t = int(input())
for tests in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		answers = []
		evens = True
		minus_3 = False
		plus_2 = False
		minus_4 = False
		special_minus_2 = False
		for num in range(n):
			if special_minus_2:
				answers.append(answers[num - 1] - 2)
				special_minus_2 = False
			elif evens:
				answers.append(2 * (num + 1))
				if n - 2 * (num + 1) <= 1:
					evens = False
			elif not minus_3:
				answers.append(answers[num - 1] - 3)
				minus_3 = True
			elif not plus_2:
				if n % 2 == 1:
					answers.append(answers[num - 1] + 4)
					special_minus_2 = True
				else:
					answers.append(answers[num - 1] + 2)
				plus_2 = True
			elif not minus_4:
				answers.append(answers[num - 1] - 4)
				minus_4 = True
			else:
				answers.append(answers[num - 1] - 2)
		print(*answers)


def solve(anss, n):
	c4 = n // 4
	for i in range(0, c4):
		if i % 2 != 0:
			anss.append(4 * i + 2)
			anss.append(4 * i + 4)
			anss.append(4 * i + 1)
			anss.append(4 * i + 3)
		else:
			anss.append(4 * i + 3)
			anss.append(4 * i + 1)
			anss.append(4 * i + 4)
			anss.append(4 * i + 2)
	ttt = c4 * 4
	xx = 1
	if ttt < n:
		ttt += xx
		val = ttt
		for i in range(0, len(anss) - 1):
			if abs(anss[i + 1] - val) >= 2 and abs(anss[i] - val) >= 2:
				if abs(anss[i] - val) <= 4 and abs(anss[i + 1] - val) <= 4:
					anss.insert(i + 1, val)
	if ttt < n:
		ttt += xx
		val = ttt
		for i in range(0, len(anss) - 1):
			if abs(anss[i + 1] - val) >= 2 and abs(anss[i] - val) >= 2:
				if abs(anss[i + 1] - val) <= 4 and abs(anss[i] - val) <= 4:
					anss.insert(i + 1, val)
	if ttt < n:
		ttt += xx
		val = ttt
		for i in range(0, len(anss) - 1):
			if abs(anss[i + 1] - val) >= 2 and abs(anss[i] - val) >= 2:
				if abs(anss[i + 1] - val) <= 4 and abs(anss[i] - val) <= 4:
					anss.insert(i + 1, val)
	print(*anss)
t = int(input())
for _ in range(0, t):
	n = int(input())
	anss = []
	if n < 4:
		print(-1)
	else:
		solve(anss, n)


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	if n <= 3:
		pr(-1)
		return
	if n == 4:
		print('3 1 4 2')
		return
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(i)
	x = i - 3
	ans.append(x)
	if n % 2 == 0:
		ans.append(n)
	ans.append(x + 2)
	x -= 2
	while x >= 2:
		ans.append(x)
		x -= 2
	print(*ans)
for _ in range(inp()):
	solve()


s = [[2, 4, 1, 3], [1, 4, 2, 5, 3], [2, 6, 3, 5, 1, 4], [1, 5, 2, 4, 7, 3, 6]]
import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
	N = int(input())
	if N <= 3:
		print(-1)
	elif N <= 7:
		print(*s[N - 4])
	else:
		r = []
		for i in range(N // 4 - 1):
			r += [x + 4 * i for x in s[0]]
		r += [x + 4 * (N // 4 - 1) for x in s[N % 4]]
		print(*r)


import sys

def perm(n):
	res = []
	if n < 4:
		return [-1]
	if n % 2 == 0:
		start = n - 1
	else:
		start = n
	while start >= 1:
		res.append(start)
		start -= 2
	res.append(4)
	res.append(2)
	for even in range(6, n + 1, 2):
		res.append(even)
	return res
number_loops = int(input())
for _ in range(number_loops):
	n = int(input())
	print(*perm(n))


def RA():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	ans = []
	if n % 2 == 0:
		s = n - 1
		while s >= 1:
			ans.append(s)
			s -= 2
		ans.append(4)
		ans.append(2)
		s = 6
		while s <= n + 1:
			ans.append(s)
			s += 2
	else:
		s = n
		while s >= 1:
			ans.append(s)
			s -= 2
		ans.append(4)
		ans.append(2)
		s = 6
		while s <= n - 1:
			ans.append(s)
			s += 2
	print(*ans)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	m = []
	l = []
	if n == 2 or n == 3:
		print('-1')
	else:
		for i in range(1, n + 1):
			if i % 2 == 0:
				l.append(i)
			else:
				m.append(i)
		(l[0], l[1]) = (l[1], l[0])
		print(*m[::-1], end=' ')
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	odd = list(range(1, n - 3, 2))
	even = list(reversed(range(2, n - 3, 2)))
	cross = [n - 1, n - 3, n, n - 2] if n % 2 == 0 else [n - 2, n, n - 3, n - 1]
	res = odd + cross + even
	print(' '.join(map(str, res)))


t = int(input())
for i in range(t):
	t1 = int(input())
	if t1 <= 3:
		print(-1)
	else:
		list1 = []
		for i in range(t1, 0, -1):
			if i % 2 != 0:
				list1.append(i)
		list1.append(4)
		list1.append(2)
		for i in range(6, t1 + 1, 2):
			list1.append(i)
		print(*list1)


for T in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n % 2 == 1:
		lis = list(range(n, 0, -2))
		lis.append(4)
		lis.append(2)
		if n >= 6:
			final = list(range(6, n, 2))
			lis.extend(final)
		print(*lis)
	else:
		lis = list(range(n - 1, 0, -2))
		lis.append(4)
		lis.append(2)
		if n >= 6:
			final = list(range(6, n + 1, 2))
			lis.extend(final)
		print(*lis)


def solve():
	n = int(input())
	if n <= 3:
		print(-1)
		return
	if n == 4:
		print('3 1 4 2')
		return
	if n > 4:
		final = '3 1 4 2'
		for i in range(5, n + 1):
			if i % 2 == 1:
				final = str(i) + ' ' + final
			else:
				final = final + ' ' + str(i)
		print(final)
t = int(input())
for tt in range(0, t):
	solve()


t = int(input())
for k in range(t):
	n = int(input())
	ans = []
	if n < 4:
		print(-1)
	else:
		for i in range(n - abs(n % 2 - 1), 0, -2):
			ans.append(i)
		ans += [4, 2]
		for i in range(6, n - n % 2 + 1, 2):
			ans.append(i)
		print(' '.join(map(str, ans)))


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		print(*[x for x in range(n - (n % 2 == 0), 0, -2)], 4, 2, *[x for x in range(6, n + 1, 2)])


from collections import deque
for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n == 4:
		l = [3, 1, 4, 2]
		print(*l)
	else:
		q = deque([])
		x = n
		if n % 2 == 1:
			x -= 1
		for i in range(x, 0, -2):
			q.append(i)
		q.append(5)
		for i in range(1, n + 1, 2):
			if i != 5:
				q.append(i)
		print(*q)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		res = [3, 1, 4, 2]
		for i in range(5, n + 1):
			if i % 2 == 0:
				res.append(i)
			else:
				res.insert(0, i)
		print(*res)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	elif n % 2:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		i = n - 3
		print(i, i + 2, end=' ')
		i = i - 2
		while i >= 1:
			print(i, end=' ')
			i -= 2
		print()
	else:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		i = n - 4
		print(i, i + 4, i + 2, end=' ')
		i -= 2
		while i >= 1:
			print(i, end=' ')
			i -= 2
		print()


for testcase in range(int(input())):
	n = int(input())
	if n <= 3:
		ans = [1 if n == 1 else -1]
	else:
		ans = list(range(2, n + 1, 2))
		if n & 1:
			ans.append(n - 4)
			ans.append(n)
			ans.append(n - 2)
			ans.extend(range(n - 6, 0, -2))
		else:
			ans.append(n - 3)
			ans.append(n - 1)
			ans.extend(range(n - 5, 0, -2))
	print(*ans)


import sys
from collections import Counter, deque
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		tem = ''
		x = 0
		c = 0
		while n:
			if n % 10:
				c += 1
				tem += str(n % 10 * 10 ** x) + ' '
			x += 1
			n //= 10
		ans += str(c) + '\n' + tem + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		(n, k) = read()
		if n == k:
			ans += 'YES\n'
			ans += '1 ' * k + '\n'
		elif k > n:
			ans += 'NO\n'
		elif n % 2 == 0:
			if k <= n // 2:
				ans += 'YES\n'
				for i in range(k - 1):
					ans += '2 '
					n -= 2
				ans += str(n) + '\n'
			elif k % 2 == 0:
				ans += 'YES\n'
				for i in range(k - 1):
					ans += '1 '
					n -= 1
				ans += str(n) + '\n'
			else:
				ans += 'NO\n'
		elif k % 2 == 0:
			ans += 'NO\n'
		else:
			ans += 'YES\n'
			for i in range(k - 1):
				ans += '1 '
				n -= 1
			ans += str(n) + '\n'
	print(ans)

def c():
	ans = ''
	for _ in range(int(inp())):
		(k, n) = read()
		t = n
		while n % k > k:
			n = n + n // k
		ans += str(t + n) + '\n'
	print(ans)

def d():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		arr = read()
		tem = 0
		dic = Counter(arr)
		for i in range(n):
			s = arr[i]
			for j in range(i + 1, n):
				s += arr[j]
				if s in dic:
					tem += dic[s]
					del dic[s]
		ans += str(tem) + '\n'
	print(ans)

def g():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		if n <= 3:
			ans += '-1\n'
		else:
			que = deque(['2', '4', '1', '3'])
			i = 5
			while i <= n:
				if i % 2 == 0:
					que.appendleft(str(i))
				else:
					que.append(str(i))
				i += 1
			ans += ' '.join(list(que)) + '\n'
	print(ans)
g()


for i in range(int(input())):
	n = int(input())
	j = 1
	if n <= 3:
		print(-1)
		continue
	if n == 4:
		print('3 1 4 2')
		continue
	while j < n + 1:
		print(j, end=' ')
		j = j + 2
	j = j - 2
	a = j - 3
	print(j - 3, end=' ')
	if j + 1 > n:
		j = j - 1
	else:
		j = j + 1
	while j > 0:
		if j == a:
			pass
		else:
			print(j, end=' ')
		j = j - 2
	print()


I = input
for i in ' ' * int(I()):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		print(*list(range(1, n + 1, 2))[::-1] + [4, 2] + list(range(6, n + 1, 2)))


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	if n == 2 or n == 3:
		print(-1)
	else:
		if n % 2 == 0:
			k = n
			while k > 0:
				if k == 4:
					k = k - 2
				else:
					arr = arr + [k]
					k = k - 2
			arr = arr + [4]
			k = k + 1
			while k < n:
				arr = arr + [k]
				k = k + 2
		else:
			k = n - 1
			while k > 0:
				if k == 4:
					k = k - 2
				else:
					arr = arr + [k]
					k = k - 2
			arr = arr + [4]
			k = k + 1
			while k <= n:
				arr = arr + [k]
				k = k + 2
		for i in range(n):
			print(arr[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	if n % 2 == 1:
		ansl = []
		p = 1
		while p != n:
			ansl.append(p)
			p += 2
		ansl.append(p)
		ansl.append(p - 3)
		ansl.append(p - 1)
		ansr = []
		q = 2
		for i in range(n - len(ansl)):
			ansr.append(q)
			q += 2
	else:
		ansl = []
		p = 2
		while p != n:
			ansl.append(p)
			p += 2
		ansl.append(p)
		ansl.append(p - 3)
		ansl.append(p - 1)
		ansr = []
		q = 1
		for i in range(n - len(ansl)):
			ansr.append(q)
			q += 2
	print(' '.join(map(str, ansl + ansr[::-1])))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		lst = [4, 2]
		lst2 = [1, 3]
		for i in range(5, n + 1):
			if i % 2 == 0:
				lst.append(i)
			else:
				lst2.append(i)
		lst2 = lst2[::-1]
		lst3 = []
		for i in lst2:
			lst3.append(i)
		for i in lst:
			lst3.append(i)
		lst3 = list(map(str, lst3))
		print(' '.join(lst3))


import sys
import math
from collections import defaultdict
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	l = []
	x = n
	if x & 1 == 0:
		x -= 1
	k = (x >> 1) + 1
	for i in range(k):
		l.append(x)
		x -= 2
	l.append(4)
	l.append(2)
	k = len(l)
	k = n - k
	x = 6
	for i in range(k):
		l.append(x)
		x += 2
	print(*l)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	for i in range(n, 0, -1):
		if i % 2:
			print(i, end=' ')
	print('4 2', end=' ')
	for i in range(5, n + 1):
		if i % 2 == 0:
			print(i, end=' ')
	print()


def permut(n):
	if n <= 3:
		return [-1]
	return [i for i in range(1, n + 1) if i % 2 == 0][::-1][:-2] + [2, 4] + [i for i in range(1, n + 1) if i % 2 != 0]
for _ in range(int(input())):
	number = int(input())
	print(' '.join([str(i) for i in permut(number)]))


from collections import defaultdict as dc
from collections import Counter
from heapq import *
import math
from bisect import bisect_left, bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def sinp():
	p = str(input())
	return p

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def check(a):
	n = len(a)
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) < 2 or abs(a[i] - a[i - 1]) > 4:
			return 'NO'
	return 'YES'

def solve(n):
	p = [0] * n
	if a < 4:
		return -1
	if a == 4:
		return [3, 1, 4, 2]
	z = n // 2
	p[z] = 1
	(l, r) = (z, z)
	l = l - 1
	r = r + 1
	p[l] = 4
	p[r] = 3
	l = l - 1
	r = r + 1
	p[l] = 2
	if n >= 5:
		p[r] = 5
		(x, y) = (5, 4)
		(l, r) = (l - 1, r + 1)
		while l >= 0 and r < n:
			p[r] = x + 2
			p[l] = y + 2
			x = p[r]
			y = p[l]
			(l, r) = (l - 1, r + 1)
		while l >= 0:
			p[l] = y + 2
			y = p[l]
			l = l - 1
		while r < n:
			p[r] = x + 2
			x = p[r]
			r += 1
	return p
for test in range(inp()):
	a = inp()
	l = solve(a)
	if l == -1:
		print(-1)
	else:
		print(*l)


def solution():
	n = int(input())
	if n < 4:
		print('-1')
		return
	answer = ''
	for i in range(n - (1 - n % 2), -1, -2):
		answer += f'{i} '
	answer += '4 2 '
	for i in range(6, n + 1, 2):
		answer += f'{i} '
	print(answer)
t = int(input())
for _ in range(t):
	solution()


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print('-1')
	elif n == 4:
		print(3, 1, 4, 2)
	elif n == 5:
		print(3, 1, 4, 2, 5)
	else:
		odds = []
		for i in range(1, n + 1, 2):
			odds.append(i)
		odds.reverse()
		for i in odds:
			print(i, end=' ')
		print(4, 2, 6, end=' ')
		for i in range(8, n + 1, 2):
			print(i, end=' ')
		print()


import sys
input = sys.stdin.buffer.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	N = getInt()
	if N < 4:
		print(-1)
		return
	lookup = dict()
	lookup[4] = [2, 4, 1, 3]
	lookup[5] = [2, 5, 3, 1, 4]
	lookup[6] = [2, 4, 6, 3, 5, 1]
	lookup[7] = [2, 5, 1, 4, 6, 3, 7]
	start = 0
	ans = []
	while N > 7:
		for j in range(4):
			ans.append(start + lookup[4][j])
		N -= 4
		start += 4
	for element in lookup[N]:
		ans.append(start + element)
	print(*ans)
T = getInt()
for t in range(T):
	solve()


for _ in ' ' * int(input()):
	n = int(input())
	odd = []
	even = []
	if n <= 3:
		print(-1)
	else:
		for i in range(1, n + 1, 2):
			odd.append(i)
		for i in range(2, n + 1, 2):
			even.append(i)
		(even[0], even[1]) = (even[1], even[0])
		print(*odd[::-1], *even)


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(n,) = I()
	if n < 4:
		print(-1)
		continue
	a = list(range(1, n + 1))
	ans = [3, 1, 4, 2]
	for i in range(5, n + 1):
		if abs(i - ans[-1]) in [2, 3, 4]:
			ans.append(i)
		elif abs(i - ans[0]) in [2, 3, 4]:
			ans.insert(0, i)
		else:
			for j in range(len(ans) - 1):
				if abs(i - ans[j]) in [2, 3, 4] and abs(i - ans[j + 1]) in [2, 3, 4]:
					ans.insert(j + 1, i)
					break
	print(*ans)


def dfs(i, visited, k, N, res):
	visited[i] = 1
	if k == N:
		return 1
	for j in range(i - 4, i - 1):
		if j >= 1 and j <= N and (not visited[j]):
			x = dfs(j, visited, k + 1, N, res)
			if x == 1:
				res.append(j)
				return x
	for j in range(i + 2, i + 5):
		if j >= 1 and j <= N and (not visited[j]):
			x = dfs(j, visited, k + 1, N, res)
			if x == 1:
				res.append(j)
				return x
	visited[i] = 0
	return 0

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		visited = [0 for i in range(N + 1)]
		for i in range(1, N + 1):
			res = []
			x = dfs(i, visited, 1, N, res)
			if x > 0:
				res.append(i)
				res.reverse()
				for j in res:
					print(j, end=' ')
				break
		if x == 0:
			print(-1)
	return
main()


for _ in range(int(input())):
	n = int(input())
	ans = []
	counter = 0
	if n <= 3:
		print(-1)
	else:
		if n % 5 == 4:
			while n != 4:
				n -= 5
				ans.append(counter + 3)
				ans.append(counter + 1)
				ans.append(counter + 4)
				ans.append(counter + 2)
				ans.append(counter + 5)
				counter += 5
			ans.append(counter + 3)
			ans.append(counter + 1)
			ans.append(counter + 4)
			ans.append(counter + 2)
		elif n % 5 == 0:
			while n != 0:
				n -= 5
				ans.append(counter + 3)
				ans.append(counter + 1)
				ans.append(counter + 4)
				ans.append(counter + 2)
				ans.append(counter + 5)
				counter += 5
		elif n % 5 == 1:
			n -= 6
			counter += 6
			ans = [1, 3, 6, 4, 2, 5]
			while n != 0:
				n -= 5
				ans.append(counter + 3)
				ans.append(counter + 1)
				ans.append(counter + 4)
				ans.append(counter + 2)
				ans.append(counter + 5)
				counter += 5
		elif n % 5 == 2:
			n -= 7
			counter += 7
			ans = [5, 1, 3, 6, 2, 4, 7]
			while n != 0:
				n -= 5
				ans.append(counter + 3)
				ans.append(counter + 1)
				ans.append(counter + 4)
				ans.append(counter + 2)
				ans.append(counter + 5)
				counter += 5
		else:
			n -= 8
			counter += 8
			ans = [1, 5, 2, 6, 3, 7, 4, 8]
			while n != 0:
				n -= 5
				ans.append(counter + 3)
				ans.append(counter + 1)
				ans.append(counter + 4)
				ans.append(counter + 2)
				ans.append(counter + 5)
				counter += 5
		print(*ans)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	f = 1
	if n < 4:
		print('-1')
	elif n == 4:
		print('2 4 1 3')
	else:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		temp = i
		for i in range(temp - 3, 1, -4):
			print(i, end=' ')
		temp = i
		if temp == 2:
			for i in range(4, n + 1, 4):
				print(i, end=' ')
				if i == n:
					f = 0
		else:
			for i in range(2, n + 1, 4):
				print(i, end=' ')
				if f == n:
					f = 0
		if f == 1 and n % 2 == 0:
			print(n, end=' ')
		print()


for i in range(int(input())):
	q = int(input())
	if q < 4:
		print(-1)
	else:
		a = [0] * q
		e = q // 4
		r = q % 4
		a[-4] = 3
		a[-1] = 2
		a[-2] = 4
		a[-3] = 1
		for i in range(q - 5, r - 1, -1):
			a[i] = a[i + 4] + 4
		if r == 1:
			a[0] = q
		elif r == 2:
			a[1] = a[2]
			a[2] = q - 1
			a[0] = q
		elif r == 3:
			a[2] = a[3]
			a[3] = a[4]
			a[4] = a[5]
			a[5] = q - 1
			a[1] = q - 2
			a[0] = q
		a = list(map(str, a))
		print(' '.join(a))


t = int(input())
while t > 0:
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n % 2 == 0:
		i = 2
		while i <= n:
			print(i, end=' ')
			i += 2
		i -= 2
		print(i - 3, end=' ')
		print(i - 1, end=' ')
		i = i - 5
		while i > 0:
			print(i, end=' ')
			i -= 2
		print()
	else:
		i = 1
		while i <= n:
			print(i, end=' ')
			i += 2
		i -= 2
		print(i - 3, end=' ')
		print(i - 1, end=' ')
		i = i - 5
		while i > 0:
			print(i, end=' ')
			i -= 2
		print()
	t -= 1


def task(n):
	if n <= 3:
		print(-1)
		return
	if n == 4:
		print('3 1 4 2')
		return
	used = [False] * (n + 1)
	current = 1
	direction = 1
	directionChanged = False
	results = [1]
	used[1] = True
	while True:
		found = False
		if direction == 1:
			for i in [2, 4, 3]:
				if current + i <= n and (not used[current + i]):
					used[current + i] = True
					current += i
					results.append(current)
					found = True
					directionChanged = False
					break
		else:
			for i in [-4, -3, -2]:
				if current + i >= 1 and (not used[current + i]):
					used[current + i] = True
					current += i
					results.append(current)
					found = True
					directionChanged = False
					break
		if not found:
			if directionChanged:
				break
			else:
				directionChanged = True
				direction *= -1
	print(' '.join(map(str, results)))
t = int(input())
for i in range(0, t):
	n = int(input())
	task(n)


def run():
	t = int(input())
	for k in range(t):
		n = int(input())
		ans = []
		if n < 4:
			print(-1)
			continue
		for i in range(n, 0, -1):
			if i % 2:
				ans.append(i)
		ans.append(4)
		ans.append(2)
		for i in range(6, n + 1, 2):
			ans.append(i)
		print(*ans)
run()


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	base = [3, 1, 4, 2]
	takes = n // 4
	res = []
	for i in range(takes):
		if i % 2 != takes % 2:
			res += [x + 4 * i for x in base]
		else:
			res += [x + 4 * i for x in base[::-1]]
	if n % 4 == 1:
		res.append(n)
	elif n % 4 == 2:
		res.insert(-1, n)
		res.append(n - 1)
	elif n % 4 == 3:
		res.insert(-1, n - 1)
		res.append(n - 2)
		res.append(n)
	print(' '.join(map(str, res)))


import math
testy = int(input(''))
wyniki = []

def permutacja(n):
	perm = [0] * n
	indeks = math.ceil((n - 4) / 2)
	perm[indeks] = 3
	perm[indeks + 1] = 1
	perm[indeks + 2] = 4
	perm[indeks + 3] = 2
	for i in range(1, n - 4 + 1):
		if i % 2 == 1:
			perm[indeks - math.ceil(i / 2)] = i + 4
		else:
			perm[indeks + 3 + math.ceil(i / 2)] = i + 4
	return perm
for i in range(0, testy):
	n = int(input(''))
	if n <= 3:
		wyniki.append([-1])
	else:
		wyniki.append(permutacja(n))
for wynik in wyniki:
	for element in wynik:
		print('{} '.format(element), end='')
	print('')


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		if n % 2 == 1:
			for index in range(n, 0, -2):
				print(index, end=' ')
		if n % 2 == 0:
			for index in range(n - 1, 0, -2):
				print(index, end=' ')
		print('4 2', end=' ')
		for index in range(6, n + 1, 2):
			print(index, end=' ')
		print('')


n = int(input())
for i in range(0, n):
	l = int(input())
	str_ = ''
	if int(l) <= 3:
		print('-1')
	elif int(l) == 4:
		print('3 1 4 2')
	else:
		k = int(l)
		t = k - (k + 1) % 2
		str_ = str_ + str(t)
		t = t - 2
		while t > 0:
			str_ = str_ + ' ' + str(t)
			t = t - 2
		str_ = str_ + ' 4 2'
		t = 6
		while t <= k:
			str_ = str_ + ' ' + str(t)
			t = t + 2
		print(str_)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	ans = [2, 4, 1, 3]
	m = 4
	idx = 1
	while m < n:
		m = m + 1
		ans.append(m)
		m = m + 1
		if m <= n:
			idx = 1
			while idx < len(ans):
				if m - ans[idx - 1] >= 2 and m - ans[idx - 1] <= 4 and (m - ans[idx] >= 2) and (m - ans[idx] <= 4):
					break
				idx = idx + 1
			ans.insert(idx, m)
	for p in ans:
		print(p, end=' ')
	print('\n')


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		arr = []
		x = n if n % 2 == 1 else n - 1
		for i in range(x, 0, -2):
			arr.append(i)
		arr += [4, 2]
		if n % 2 == 0:
			n += 1
		for i in range(6, n, 2):
			arr += [i]
		print(*arr)


from collections import defaultdict
from math import ceil
from queue import LifoQueue

def print_sol(c, sol):
	print('Case #{}: {}'.format(c, sol))

def rd_int():
	return int(input())

def rd_str():
	return input()

def rd_str_lst():
	return input().split(' ')

def sp_str_lst():
	return list(input())

def rd_int_lst():
	return [int(i) for i in rd_str_lst()]

def sp_int_lst():
	return [int(i) for i in sp_str_lst()]

def dfs(g, i, v):
	v[i] = True
	for j in g[i]:
		if not v[j]:
			dfs(g, j, v)
	print(i)

def dfs_iter(g, i, n):
	v = [False] * n
	stack = LifoQueue()
	stack.put(i)
	while stack.not_empty:
		u = stack.get()
		v[u] = True
		print(u)
		for i in g[u]:
			if not v[i]:
				stack.put(i)

def als(x):
	sa = [1 if i % 2 == 0 else 0 for i in range(x)]
	return sa

def main():
	t = rd_int()
	for c in range(1, t + 1):
		n = rd_int()
		if n < 4:
			print(-1)
			continue
		sol = [-1] * n
		start = n - 1 if n % 2 == 0 else n
		i = 0
		oe = (start + 1) / 2
		while i < oe:
			sol[i] = start
			start -= 2
			i += 1
		sol[i] = 4
		sol[i + 1] = 2
		if n > 4:
			i += 2
			start = 6
			while i < n:
				sol[i] = start
				start += 2
				i += 1
		print(*sol)
main()


for _ in range(int(input())):
	n = int(input())
	if n == 4:
		print(3, 1, 4, 2)
		continue
	if n < 5:
		print(-1)
		continue
	arr = []
	done = [False] * n
	for i in range(0, n, 2):
		arr.append(i)
		done[i] = True
	for i in range(arr[-1] - 3, 0, -4):
		arr.append(i)
		done[i] = True
	for i in range(n):
		if not done[i]:
			arr.append(i)
	print(*[e + 1 for e in arr])


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		k = []
		for t in range(n, 0, -2):
			k.append(t)
		l = []
		for t in range(n - 3, 0, -2):
			l.append(t)
		l.insert(1, n - 1)
		l.reverse()
		print(*l, *k)


t = int(input())
for _ in range(t):
	number = int(input())
	if number < 4:
		print(-1)
		continue
	ans = []
	last_odd = number - (0 if number % 2 else 1)
	while last_odd != -1:
		ans.append(last_odd)
		last_odd -= 2
	ans.append(4)
	ans.append(2)
	curr = 6
	while curr <= number:
		ans.append(curr)
		curr += 2
	print(' '.join([str(i) for i in ans]))


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	l = [1]
	while l[-1] + 2 <= n:
		l.append(l[-1] + 2)
	l.reverse()
	l.append(4)
	l.append(2)
	if n >= 6:
		l.append(6)
		while l[-1] + 2 <= n:
			l.append(l[-1] + 2)
	print(*l)


for _ in range(int(input())):
	n = int(input())
	arr = ''
	count = 0
	mid = ''
	lef = ''
	rig = ''
	if n < 4:
		print('-1')
	else:
		if n % 2 == 1:
			parity = 1
		else:
			parity = 0
		n = n - 4
		for i in range(n // 2 + parity):
			lef += str(2 * (i + 1) - 1) + ' '
			count += 1
		for i in range(n // 2 - 1, -1, -1):
			rig += ' ' + str(2 * (i + 1))
			count += 1
		if parity == 0:
			mid = str(count + 2) + ' ' + str(count + 4) + ' ' + str(count + 1) + ' ' + str(count + 3)
		else:
			mid += str(count + 3) + ' ' + str(count + 1) + ' ' + str(count + 4) + ' ' + str(count + 2)
		print(lef + mid + rig)


class Solution:

	def getPermutation(self, num):
		self.ans = []
		val = list(range(1, num + 1))
		n = len(val)

		def permute(idx):
			if idx == n and len(self.ans) == num:
				return True
			ans = False
			for i in range(idx, n):
				if not self.ans or 2 <= abs(val[i] - self.ans[-1]) <= 4:
					self.ans.append(val[i])
					(val[i], val[idx]) = (val[idx], val[i])
					ans = ans or permute(idx + 1)
					(val[i], val[idx]) = (val[idx], val[i])
					if ans:
						return True
					self.ans.pop()
			return ans
		permute(0)
		return self.ans
t = int(input())
for _ in range(t):
	ans = Solution().getPermutation(int(input()))
	if not ans:
		ans = [-1]
	for val in ans:
		print(val, end=' ')


for _ in range(int(input())):
	n = int(input())
	if n > 3:
		even = []
		odd = []
		while n > 0:
			if n % 2 == 0:
				even.append(n)
				n -= 1
			else:
				odd.append(n)
				n -= 1
		odd.sort()
		even.sort()
		odd.reverse()
		even.reverse()
		even.remove(4)
		even.append(4)
		even.reverse()
		a = []
		a.extend(odd)
		a.extend(even)
		print(*a)
	else:
		print(-1)


def fG(k):
	r = []
	if k < 4:
		print(-1)
		return
	for i in range(1, k + 1, 2):
		r.append(i)
	r = r[::-1]
	r = r + [4, 2]
	for i in range(6, k + 1, 2):
		r.append(i)
	return r
n = int(input())
for i in range(n):
	r = fG(int(input()))
	if r != None:
		for j in r:
			print(j, end=' ')


for q in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
	elif n < 4:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		ans = []
		while n >= 10:
			ans.extend([n, n - 3, n - 1, n - 4, n - 2])
			n -= 5
		if n == 5:
			ans.extend([n, n - 3, n - 1, n - 4, n - 2])
		elif n == 6:
			ans.extend([n, n - 3, n - 1, n - 4, n - 2, n - 5])
		elif n == 7:
			ans.extend([n, n - 3, n - 1, n - 5, n - 2, n - 6, n - 4])
		elif n == 8:
			ans.extend([n, n - 3, n - 1, n - 5, n - 2, n - 6, n - 4, n - 7])
		elif n == 9:
			ans.extend([n, n - 3, n - 1, n - 4, n - 7, n - 5, n - 2, n - 6, n - 8])
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(-1)
	elif n == 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		odd = [i for i in range(1, n + 1, 2)]
		even = [i for i in range(2, n + 1, 2)]
		no = len(odd)
		ne = len(even)
		if ne == no:
			(odd[no - 1], odd[no - 2]) = (odd[no - 2], odd[no - 1])
			all = even + odd[::-1]
		else:
			(even[ne - 1], even[ne - 2]) = (even[ne - 2], even[ne - 1])
			all = odd + even[::-1]
		print(' '.join(map(str, all)))


def give(n):
	a = []
	if n < 4:
		a += (-1,)
		return a
	i = 1 + (n % 2 == 0)
	while i <= n:
		a += (i,)
		i += 2
	b = [-3, 2, -4, -2]
	i = 0
	d = a[-1]
	n -= (n + 1) // 2
	while n:
		d += b[i]
		a += (d,)
		n -= 1
		i = min(i + 1, 3)
	return a
for _ in range(int(input())):
	n = int(input())
	a = give(n)
	print(*a)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
	elif n in (2, 3):
		print(-1)
	else:
		a = list(range(1, n + 1, 2))[::-1] + [4, 2] + list(range(6, n + 1, 2))
		print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	else:
		start = [2, 4, 1, 3]
		rest = n % 4
		for number in range(n - 4 - rest):
			start.append(start[-4] + 4)
		newarr = []
		if rest == 1:
			start.append(n)
		elif rest == 2:
			newarr = [n - 1, start[-1], n]
			del start[-1]
		elif rest == 3:
			newarr = [n - 2, n, start[-1], n - 1]
			del start[-1]
		for element in newarr:
			start.append(element)
		print(*start)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ptn = [0] * 10
	ptn[4] = [2, 4, 1, 3]
	ptn[5] = [1, 3, 5, 2, 4]
	ptn[6] = [1, 3, 5, 2, 4, 6]
	ptn[7] = [1, 4, 2, 5, 7, 3, 6]
	if n < 8:
		print(*ptn[n])
	else:
		ans = []
		m = n % 4
		l = n // 4
		now = 0
		while l > 1:
			for i in range(4):
				ans.append(ptn[4][i] + now)
			l -= 1
			now += 4
		for i in range(len(ptn[m + 4])):
			ans.append(ptn[m + 4][i] + now)
		print(*ans)


for __ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		ans = []
		for i in range(n, 0, -1):
			if i % 2 == 1:
				ans.append(i)
		ans.append(4)
		ans.append(2)
		for i in range(6, n + 1):
			if i % 2 == 0:
				ans.append(i)
		print(*ans)


for t in range(int(input())):
	n = int(input())
	string = '3 1 4 2'
	if n > 3:
		for i in range(5, n + 1):
			if i & 1:
				string += ' ' + str(i)
			else:
				string = str(i) + ' ' + string
		print(string)
	else:
		print(-1)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	if N == 2 or N == 3:
		print(-1)
		return
	if N == 1:
		print(1)
		return
	ans = [0 for _ in range(N)]
	i = N // 2 - 1
	ans[i - 1] = 3
	ans[i] = 1
	ans[i + 1] = 4
	ans[i + 2] = 2
	i += 3
	for k in range(4, N):
		ans[i] = k + 1
		if k % 2 == 0:
			i -= k + 1
		else:
			i += k + 1
	print(*ans, sep=' ')

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


def permutation(n):
	even = []
	odd = []
	if n < 4:
		return -1
	for number in range(1, n + 1):
		if number % 2 == 0:
			even.append(number)
		else:
			odd.append(number)
	odd.reverse()
	(even[0], even[1]) = (even[1], even[0])
	perm = odd + even
	permString = ''
	for number in range(0, len(perm) - 1):
		permString += str(perm[number]) + ' '
	permString += str(perm[-1])
	return permString
numberOfTestCases = int(input())
for cases in range(0, numberOfTestCases):
	n = int(input())
	print(permutation(n))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	elif n % 2 == 1:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		print('{} {} '.format(n - 3, n - 1), end=' ')
		for i in range(n - 5, 0, -2):
			print(i, end=' ')
		print()
	else:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		print('{} {} {} '.format(n - 4, n, n - 2), end=' ')
		for i in range(n - 6, 0, -2):
			print(i, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(n, 0, -1):
		if i % 2 == 1:
			l.append(i)
	idx = len(l)
	for i in range(2, n + 1, 2):
		l.append(i)
	if n < 4:
		print('-1')
	else:
		(l[idx], l[idx + 1]) = (l[idx + 1], l[idx])
		for i in l:
			print(i, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	ans = []
	if n <= 3:
		print(-1)
	elif n % 2 == 1:
		val = n
		while val >= 1:
			ans.append(val)
			val -= 2
		if (n - 1) % 4 == 0:
			val = 4
			while val <= n - 1:
				ans.append(val)
				val += 4
			val -= 4
			val -= 2
			while val > 1:
				ans.append(val)
				val -= 4
		else:
			val = 4
			while val <= n - 1:
				ans.append(val)
				val += 4
			val -= 4
			val += 2
			ans.append(val)
			val -= 4
			while val > 1:
				ans.append(val)
				val -= 4
	else:
		val = n - 1
		while val >= 1:
			ans.append(val)
			val -= 2
		if n % 4 == 0:
			val = 4
			while val <= n:
				ans.append(val)
				val += 4
			val -= 4
			val -= 2
			while val > 1:
				ans.append(val)
				val -= 4
		else:
			val = 4
			while val <= n:
				ans.append(val)
				val += 4
			val -= 4
			val += 2
			ans.append(val)
			val -= 4
			while val > 1:
				ans.append(val)
				val -= 4
	print(*ans)


for _ in range(int(input())):
	(n, a) = (int(input()), [])
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		for i in range(1, n + 1, 2):
			a.append(i)
		if n % 2 == 1:
			(a.append(n - 3), a.append(n - 1))
			for i in range(n - 5, 0, -2):
				a.append(i)
		if n % 2 == 0:
			(a.append(n - 4), a.append(n), a.append(n - 2))
			for i in range(n - 6, 0, -2):
				a.append(i)
		for i in range(len(a)):
			print(a[i], end=' ')
		print()


t = int(input())
for z in range(t):
	s = []
	n = int(input())
	if n < 4:
		print(-1)
	else:
		if n % 2 == 1:
			a = n
		else:
			a = n - 1
		for i in range(a, -1, -2):
			s += [i]
		s += [4]
		s += [2]
		if n % 2 == 1:
			for i in range(6, n + 1, +2):
				s += [i]
		else:
			for i in range(6, n + 2, +2):
				s += [i]
		for i in range(len(s)):
			print(s[i], end=' ')
		print()


n = int(input())
e10 = [[], [], [], [], [3, 1, 4, 2], [3, 1, 4, 2, 5], [3, 6, 2, 4, 1, 5], [1, 3, 6, 2, 4, 7, 5], [1, 3, 6, 2, 4, 7, 5, 8], [2, 5, 1, 3, 7, 4, 8, 6, 9], [2, 5, 1, 3, 7, 4, 8, 10, 6, 9], [2, 5, 1, 3, 7, 4, 8, 10, 6, 9, 11], [2, 5, 1, 3, 7, 4, 8, 12, 10, 6, 9, 11], [2, 5, 1, 3, 7, 4, 8, 12, 10, 6, 9, 11, 13]]
for _ in range(n):
	m = int(input())
	if m <= 3:
		print(-1)
		continue
	if m % 10 == 2 or m % 10 == 3 or m % 10 == 1:
		cnt = m // 10 - 1
		for i in range(cnt):
			for j in range(10):
				print(i * 10 + e10[10][j], end=' ')
		for i in e10[10 + m % 10]:
			print(i + 10 * cnt, end=' ')
		print()
	else:
		cnt = m // 10
		rem = m % 10
		for i in range(cnt):
			for j in range(10):
				print(i * 10 + e10[10][j], end=' ')
		if rem == 0:
			print()
			continue
		else:
			for i in e10[rem]:
				print(i + 10 * cnt, end=' ')
			print()


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		l = int(stdin.readline())
		if l < 4:
			stdout.write(str(-1) + '\n')
			continue
		ans = [3, 1, 4, 2]
		for i in range(5, l + 1):
			if i & 1:
				ans.insert(0, i)
			else:
				ans.append(i)
		stdout.write(' '.join(map(str, ans)) + '\n')
main()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	elif n & 1:
		for j in range(n, 4, -2):
			print(j, end=' ')
		print('3 1 4 2', end=' ')
		for j in range(6, n + 1, 2):
			print(j, end=' ')
		print()
	else:
		for j in range(n - 1, 3, -2):
			print(j, end=' ')
		print('3 1 4 2', end=' ')
		for j in range(6, n + 1, 2):
			print(j, end=' ')
		print()


from sys import stdin
input = stdin.readline
for Ti in range(int(input().strip())):
	n = int(input().strip())
	if n <= 3:
		print('-1')
		continue
	ans = []
	for ni in range(n // 4):
		ans.append(ni * 4 + 2)
		ans.append(ni * 4 + 4)
		ans.append(ni * 4 + 1)
		ans.append(ni * 4 + 3)
	if n % 4 == 1:
		ans.append(n)
	if n % 4 == 2:
		ans.append(n - 1)
		ans.append(n)
		(ans[-3], ans[-2]) = (ans[-2], ans[-3])
	if n % 4 == 3:
		ans.pop()
		ans.append(n - 2)
		ans.append(n)
		ans.append(n - 4)
		ans.append(n - 1)
	print(*ans)


from math import factorial

def read():
	return [int(i) for i in input().split()]
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	if n in [2, 3]:
		print(-1)
		continue
	k = n % 4
	n -= k
	for i in range(0, n, 4):
		for j in [2, 4, 1, 3]:
			l.append(i + j)
	n += k
	if k == 1:
		l.append(n)
	if k == 2:
		l.append(n - 1)
		l.insert(-4, n)
	if k == 3:
		l.append(n - 2)
		l.insert(-4, n - 1)
		l.append(n)
	print(*l)


def createPerm(n):
	arr = ['-1' for i in range(1001)]
	arr[2] = '3 1 4 2'
	for i in range(3, n):
		if (i + 2) % 2 != 0:
			arr[i] = str(i + 2) + ' ' + arr[i - 1]
		else:
			arr[i] = arr[i - 1] + ' ' + str(i + 2)
	return arr
arr = createPerm(1001)
for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		for ele in arr[n - 2]:
			print(ele, end='')
		print()


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):

		def dfs(i, log):
			if len(log) == n:
				return log
			for j in [i - 4, i - 3, i - 2, i + 4, i + 3, i + 2]:
				if not 0 <= j < n:
					continue
				if fin[j]:
					continue
				fin[j] = True
				ret = dfs(j, log + [j + 1])
				fin[j] = False
				if ret != [-1]:
					return ret
			return [-1]
		n = II()
		for i in range(n):
			fin = [False] * n
			fin[i] = True
			ans = dfs(i, [i + 1])
			if ans != [-1]:
				break
		print(*ans)
main()


t = int(input())
for i in range(t):
	n = int(input())
	L = []
	if n >= 5:
		for i in range(1, n + 1, 2):
			L.append(i)
		L.append(L[-1] - 3)
		if n % 2 == 0:
			L.append(L[-1] + 4)
			L.append(L[-1] - 2)
		if n % 2 == 1:
			L.append(L[-1] + 2)
		L.append(L[-1] - 4)
		while L[-1] > 0:
			L.append(L[-1] - 2)
		s = ''
		for i in range(len(L) - 1):
			s += str(L[i]) + ' '
		print(s)
	elif n == 4:
		print('3 1 4 2')
	else:
		print(-1)


import sys
t = int(input())
for test in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	arr = [3, 1, 4, 2]
	for i in range(5, n + 1):
		if i % 2 == 0:
			arr.insert(0, i)
		else:
			arr.append(i)
	print(*arr)


def solve(n):
	if n <= 3:
		return [-1]
	BASE_CASE = [2, 4, 1, 3]
	r = []
	for i in range(0, n // 4):
		r += [x + i * 4 for x in BASE_CASE]
	if n % 4 == 1:
		r.append(n)
	elif n % 4 == 2:
		v = r.pop()
		r.append(n - 1)
		r.append(v)
		r.append(n)
	elif n % 4 == 3:
		v = r.pop()
		r.append(n - 2)
		r.append(n)
		r.append(v)
		r.append(n - 1)
	return r
for _ in range(int(input())):
	n = int(input())
	r = solve(n)
	print(' '.join(map(str, r)))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1, end='')
	else:
		p = []
		for i in range(n, -1, -1):
			if i % 2 == 1:
				p.append(i)
		p.append(4)
		p.append(2)
		for i in range(6, n + 1, 2):
			p.append(i)
		for i in p:
			print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	dec = []
	if n <= 3:
		print(-1)
		continue
	for x in range(n + 1):
		if x % 2 != 0:
			dec.append(x)
	dec.sort(reverse=True)
	dec.append(4)
	dec.append(2)
	for x in range(5, n + 1):
		if x % 2 == 0:
			dec.append(x)
	print(*dec, sep=' ')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' ', end='\n'):
	print(sep.join(map(str, a)), end=end)

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
for _ in range(ii()):
	n = ii()
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print('3 1 4 2')
		continue
	a = []
	b = []
	c = []
	d = []
	for i in range(1, n + 1, 4):
		a.append(i)
		if i + 1 <= n:
			b.append(i + 1)
		if i + 2 <= n:
			c.append(i + 2)
		if i + 3 <= n:
			d.append(i + 3)
	d.reverse()
	c.reverse()
	print(*b, *d, *a, *c)


t = int(input())
dic = {}
dic[0] = [1, 4, 2, 5, 3]
dic[1] = [1, 4, 2, 6, 3, 5]
dic[2] = [1, 3, 6, 2, 4, 7, 5]
dic[3] = [1, 3, 6, 8, 4, 2, 5, 7]
dic[4] = [1, 3, 6, 9, 7, 4, 2, 5, 8]
for loop in range(t):
	n = int(input())
	if n == 4:
		print('3 1 4 2')
		continue
	elif n < 4:
		print(-1)
		continue
	ans = dic[n % 5].copy()
	while len(ans) < n:
		la = len(ans)
		ans += [la + 1, la + 4, la + 2, la + 5, la + 3]
	print(*ans)


for s in [*open(0)][1:]:
	n = int(s)
	print(*[[*range(n - n % 2, 4, -2), 2, 4, *range(1, n + 1, 2)], [-1]][n < 4])


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		if n <= 3:
			print(-1)
		elif n % 2 == 0:
			for x in range(2, n + 1, 2):
				print(x, end=' ')
			chk = 0
			for x in range(n - 3, 0, -2):
				print(x, end=' ')
				if chk == 0:
					print(n - 1, end=' ')
					chk = 1
			print()
		else:
			for x in range(1, n + 1, 2):
				print(x, end=' ')
			chk = 0
			for x in range(n - 3, 0, -2):
				print(x, end=' ')
				if chk == 0:
					print(n - 1, end=' ')
					chk = 1
			print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		if n % 2 == 0:
			l = [i for i in range(1, n + 1)]
			l1 = [n - 1]
			l.remove(n - 1)
		else:
			l = [i for i in range(1, n)]
			l1 = [n]
		l.sort()
		l.reverse()
		front = 0
		top = 0
		count = 0
		d = len(l) - 1
		m = 0
		while count != d:
			if front > len(l) - 1:
				m = 1
				break
			if 2 <= abs(l1[top] - l[front]) <= 4:
				l1.append(l[front])
				l.remove(l[front])
				front = 0
				top += 1
				count += 1
			else:
				front += 1
		if m == 1:
			l.sort()
			l.reverse()
			for i in range(0, len(l1) - 1):
				if 2 <= abs(l1[i] - l[0]) <= 4 and 2 <= abs(l1[i + 1] - l[0]) <= 4:
					l3 = l1[0:i + 1] + [l[0]] + l1[i + 1:]
					c = 1
					break
				elif abs(l[0] - l1[0]) <= 4 and abs(l[0] - l1[0]) >= 2:
					l3 = [l[0]] + l1
					break
				elif abs(l[0] - l1[len(l1) - 1]) <= 4 and abs(l[0] - l1[len(l1) - 1]) >= 2:
					l3 = l1 + [l[0]]
					break
			for i in range(0, len(l1) - 1):
				if 2 <= abs(l3[i] - l[1]) <= 4 and 2 <= abs(l3[i + 1] - l[1]) <= 4:
					l3 = l3[0:i + 1] + [l[1]] + l3[i + 1:]
					break
				elif abs(l[1] - l3[0]) <= 4 and abs(l[1] - l3[0]) >= 2:
					l3 = [l[1]] + l3
					break
				elif abs(l[1] - l3[len(l3) - 1]) <= 4 and abs(l[1] - l3[len(l3) - 1]) >= 2:
					l3 = l3 + [l[1]]
					break
			print(*l3)
		else:
			for i in range(0, len(l1) - 1):
				if 2 <= abs(l1[i] - l[0]) <= 4 and 2 <= abs(l1[i + 1] - l[0]) <= 4:
					l3 = l1[0:i + 1] + [l[0]] + l1[i + 1:]
					break
				elif abs(l[0] - l1[0]) <= 4 and abs(l[0] - l1[0]) >= 2:
					l3 = [l[0]] + l1
					break
				elif abs(l[0] - l1[len(l1) - 1]) <= 4 and abs(l[0] - l1[len(l1) - 1]) >= 2:
					l3 = l1 + [l[0]]
					break
			print(*l3)


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	n = inputnum()
	if n < 4:
		print(-1)
		continue
	rtn = [3, 1, 4, 2]
	for i in range(5, n + 1):
		if i % 2 == 0:
			rtn.append(i)
		else:
			rtn.insert(0, i)
	print(*rtn)


for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	l = []
	for j in range(n, 0, -1):
		if j % 2 == 1:
			l.append(j)
	for j in range(1, n + 1):
		if j % 2 == 0:
			l.append(j)
	a = l.index(2)
	b = l.index(4)
	l[a] = 4
	l[b] = 2
	for j in range(len(l)):
		if j == len(l) - 1:
			print(l[j])
		else:
			print(l[j], end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	l = []
	if n % 2 == 0:
		start = 2
	else:
		start = 1
	while start <= n:
		l.append(start)
		if start == n:
			break
		start += 2
	start -= 1
	f = 0
	l += [start - 2, start]
	start -= 4
	while start >= 1:
		l.append(start)
		start -= 2
	print(*l)


t = input()
for i in range(int(t)):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	arr_odd = [i * 2 + 1 for i in range((n + 1) // 2)]
	arr_even = [(i + 1) * 2 for i in range(n // 2)]
	if arr_even[-1] > arr_odd[-1]:
		print(*arr_odd, arr_even[-3], arr_even[-1], arr_even[-2], *reversed(arr_even[:-3]))
	else:
		print(*arr_odd, arr_even[-2], arr_even[-1], *reversed(arr_even[:-2]))


import sys
t = int(input())
for j in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	else:
		k = 1
		while k <= n:
			print(k, end=' ')
			k += 2
		if n % 2 == 0:
			print(n - 4, end=' ')
			print(n, end=' ')
			print(n - 2, end=' ')
			k = n - 6
			while k != 0:
				print(k, end=' ')
				k = k - 2
			print()
		else:
			print(n - 3, end=' ')
			print(n - 1, end=' ')
			k = n - 5
			while k != 0:
				print(k, end=' ')
				k = k - 2
			print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	if n == 4:
		print('3 1 4 2')
	if n == 5:
		print('3 1 4 2 5')
	if n == 6:
		print('6 3 1 4 2 5')
	if n > 6:
		i = n // 2
		while i > 3:
			print(2 * i, end=' ')
			i -= 1
		print('6 3 1 4 2 5', end=' ')
		i = 3
		while i * 2 + 1 <= n:
			print(2 * i + 1, end=' ')
			i += 1
		print('')


for i in range(int(input())):
	n = int(input())
	arr = []
	if n <= 3:
		print(-1)
	else:
		i = 2
		while i <= n:
			arr.append(i)
			i += 2
		if n % 2 == 0:
			j = n - 1
		else:
			j = n
		while j >= 1:
			arr.append(j)
			j -= 2
		if n % 2 == 0:
			x = n // 2 - 1
			temp = arr[x + 2]
			arr[x + 2] = arr[x + 1]
			arr[x + 1] = temp
			print(*arr)
		else:
			x = n // 2 - 1
			temp = arr[x]
			arr[x] = arr[x - 1]
			arr[x - 1] = temp
			print(*arr)


for x in range(int(input())):
	n = int(input())
	a = []
	for i in range(n // 4 - 1):
		a.extend([4 * i + 2, 4 * i + 4, 4 * i + 1, 4 * i + 3])
	if n % 4 == 0:
		a.extend([n - 2, n, n - 3, n - 1])
	elif n % 4 == 1:
		a.extend([n - 3, n - 1, n - 4, n, n - 2])
	elif n % 4 == 2:
		a.extend([n - 4, n, n - 2, n - 5, n - 1, n - 3])
	elif n % 4 == 3:
		a.extend([n - 5, n - 1, n - 3, n - 6, n - 2, n - 4, n])
	if n < 4:
		print(-1)
	else:
		print(*a)


import sys
import math
from bisect import bisect_right as br
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	elif n == 4:
		print(3, 1, 4, 2)
		continue
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(i)
	if n % 2 != 0:
		ans.append(n - 3)
		skip = n - 3
		itr = n - 1
	else:
		ans.append(n - 4)
		skip = n - 4
		itr = n
	for i in range(itr, 0, -2):
		if i != skip:
			ans.append(i)
	print(*ans)


def solve():
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		return
	if n % 2 != 0:
		li = [i for i in range(1, n + 1, 2)]
		li2 = [i for i in range(2, n, 2)]
		li = li + li2[::-1]
		x = n // 2 + 1
		(li[x], li[x + 1]) = (li[x + 1], li[x])
	else:
		li = [i for i in range(1, n, 2)]
		li2 = [i for i in range(2, n + 1, 2)]
		li = li2 + li[::-1]
		x = n // 2
		(li[x], li[x + 1]) = (li[x + 1], li[x])
	print(*li)
	return
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	N = int(input())
	A = [0] * N
	if N > 3:
		for I in range(0, N - N % 4, 4):
			A[I] = I + 2
			A[I + 1] = I + 4
			A[I + 2] = I + 1
			A[I + 3] = I + 3
		if N % 4 == 1:
			A[-1] = N
		elif N % 4 == 2:
			A[-3] = N - 1
			A[-2] = N - 3
			A[-1] = N
		elif N % 4 == 3:
			A[-2] = N - 4
			A[-4] = N - 2
			A[-1] = N - 1
			A[-3] = N
		print(' '.join(map(str, A)))
	else:
		print(-1)


def fard(n):
	s = [0] * n
	i = 0
	m = n
	while m > 0:
		s[i] = m
		m -= 2
		i += 1
	s[i] = 4
	i += 1
	s[i] = 2
	i += 1
	if n == 5:
		print(*s)
		return
	s[i] = 6
	i += 1
	m = 8
	while m < n:
		s[i] = m
		m += 2
		i += 1
	print(*s)

def zoj(n):
	s = [0] * n
	i = 0
	m = 1
	while m < n:
		s[i] = m
		m += 2
		i += 1
	s[i] = n - 4
	i += 1
	s[i] = n
	i += 1
	s[i] = n - 2
	i += 1
	if n > 6:
		s[i] = n - 6
		i += 1
		m = n - 8
	else:
		print(*s)
		return
	while m > 1:
		s[i] = m
		m -= 2
		i += 1
	print(*s)

def solve(n):
	if n < 4:
		print(-1)
		return
	if n == 4:
		print(2, 4, 1, 3)
		return
	if n % 2:
		fard(n)
	else:
		zoj(n)
for _ in range(int(input())):
	solve(int(input()))


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		output = []
		perm_odd = range(1, n + 1, 2)
		perm_even = range(2, n + 1, 2)
		for num in perm_odd:
			output.append(num)
		output.reverse()
		for num in perm_even:
			if num == 2:
				output.append(4)
			elif num == 4:
				output.append(2)
			else:
				output.append(num)
		for num in output:
			print(num, end=' ')
		print('')


def version1():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
		else:
			if n % 2 == 0:
				p = n - 1
			else:
				p = n
			result = ''
			for i in range(p, 0, -2):
				result += str(i) + ' '
			result += '4 2 '
			if n % 2 == 0:
				p = n
			else:
				p = n - 1
			for i in range(6, p + 1, 2):
				result += str(i) + ' '
			print(result)

def version2():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
			continue
		for i in range(n, 0, -1):
			if i & 1:
				print(i, '', end='')
		print('4 2 ', end='')
		for i in range(6, n + 1, 2):
			print(i, '', end='')
		print()
version2()


for tc in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		if n % 2:
			o = n
		else:
			o = n - 1
		ans = []
		while o >= 5:
			ans.append(o)
			o -= 2
		ans += [2, 4, 1, 3]
		o = 6
		while o <= n:
			ans.append(o)
			o += 2
		print(*ans)


def step_permutation(n):
	if n == 0:
		return []
	elif n < 4:
		return [-1]
	elif n % 2 == 1:
		return step_permutation(n - 1) + [n]
	elif n % 4 == 2:
		return step_permutation(n - 6) + [n - 5, n - 2, n - 4, n, n - 3, n - 1]
	else:
		ans = []
		for j in range(int(n / 4)):
			ans += [j * 4 + 2, j * 4 + 4, j * 4 + 1, j * 4 + 3]
		return ans
t = int(input())
for i in range(t):
	ans = step_permutation(int(input()))
	print(' '.join([str(i) for i in ans]))


from math import ceil
for _ in range(int(input())):
	i = int(input())
	if i <= 3:
		print(-1)
	elif i == 4:
		print('3 1 4 2')
	else:
		s = i // 4 - 1
		r = i % 4
		x = i - r - 4
		m = [2 + x, 4 + x, x + 1, 3 + x]
		if r >= 1:
			m.insert(4, x + 4 + 1)
		if r >= 2:
			m.insert(1, x + 4 + 2)
		if r >= 3:
			m.insert(5, x + 4 + 3)
		t = []
		for x in range(s):
			t.append(x * 4 + 2)
			t.append(x * 4 + 4)
			t.append(x * 4 + 1)
			t.append(x * 4 + 3)
		t += m
		print(*t)


q = int(input())
for i in range(q):
	a = int(input())
	if a < 4:
		print(-1)
	else:
		if a % 2 == 0:
			t = a - 1
		else:
			t = a
		s = ''
		while t > 0:
			s += ' ' + str(t)
			t -= 2
		t += 5
		s += ' ' + str(t)
		t -= 2
		s += ' ' + str(t)
		t += 4
		while t <= a:
			s += ' ' + str(t)
			t += 2
		print(s)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	l = []
	if n <= 5:
		if n == 2:
			print(-1)
		elif n == 3:
			print(-1)
		elif n == 4:
			print(3, 1, 4, 2)
		else:
			print(5, 3, 1, 4, 2)
	elif n % 2 == 0:
		for i in range(n, 0, -2):
			l.append(i)
		for i in range(5, n, 2):
			l.append(i)
		temp = l.index(5)
		l.insert(temp + 1, 3)
		temp = l.index(3)
		l.insert(temp, 1)
		print(*l, sep=' ')
	else:
		for i in range(n, 1, -2):
			l.append(i)
		l.extend([6, 2, 4])
		for i in range(8, n, 2):
			l.append(i)
		temp = l.index(3)
		l.insert(temp, 1)
		print(*l, sep=' ')


def doit(ans, init, n):
	ans.append(init)
	cnt = 0
	while ans[-1] + 2 <= n:
		if ans[-1] + 4 <= n:
			ans.append(ans[-1] + 4)
		else:
			ans.append(ans[-1] + 2)
			cnt = 1
	if cnt == 1:
		ans.append(ans[-1] - 4)
	else:
		ans.append(ans[-1] - 2)
	while ans[-1] - 4 >= init - 2:
		ans.append(ans[-1] - 4)

def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	ans = list()
	doit(ans, 3, n)
	doit(ans, 4, n)
	print(' '.join(map(str, ans)))
t = int(input())
while t > 0:
	t -= 1
	solve()


def main():
	n = int(input())
	if n <= 3:
		print(-1)
		return
	s = 2
	if n % 2:
		s = 1
	while s <= n:
		print(s, end=' ')
		s += 2
	s -= 5
	print(s, end=' ')
	print(s + 2, end=' ')
	while s > 2:
		s -= 2
		print(s, end=' ')
	print('')
for _ in range(int(input())):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	o = []
	e = []
	for i in range(1, n + 1):
		if i % 2 != 0:
			o.append(i)
		elif i % 2 == 0:
			e.append(i)
	o.sort(reverse=True)
	if n < 4:
		print(-1)
	elif n >= 4:
		e.remove(4)
		o.append(4)
		op = o + e
		print(*op)


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		l1 = []
		for j in range(1, n + 1, 2):
			l1.append(j)
		l1 = l1[::-1]
		l1.append(4)
		l1.append(2)
		if len(l1) != n:
			l1.append(6)
		if len(l1) != n:
			for j in range(8, n + 1, 2):
				l1.append(j)
		print(*l1)


for s in [*open(0)][1:]:
	n = int(s)
	if n < 4:
		print(-1)
	else:
		b = [*range(n - 1, 0, -2)]
		(b[0], b[1]) = (b[1], b[0])
		print(*[*range(2 - n % 2, n + 1, 2), *b])


t = int(input())
for test in range(t):
	n = int(input())
	l = list(range(2, n + 1, 2))
	if l[-1] - 3 >= 1:
		l.append(l[-1] - 3)
		if l[-1] + 4 == n:
			c = l[-1]
			l.append(n)
			num = n - 2
			while num >= 1:
				if num != c:
					l.append(num)
				num -= 2
		else:
			l.append(l[-1] + 2)
			num = l[-1] - 4
			while num >= 1:
				l.append(num)
				num -= 2
	if len(l) == n:
		print(*l)
	else:
		print(-1)


import sys
from math import ceil
from itertools import islice, cycle
from collections import Counter, defaultdict
stdin = sys.stdin
t = stdin.readline()
t = int(t)
perms = {4: [2, 4, 1, 3], 5: [1, 3, 5, 2, 4], 6: [1, 3, 6, 4, 2, 5], 7: [1, 3, 7, 5, 2, 4, 6]}
for test in range(t):
	n = stdin.readline()
	n = int(n)
	if n < 4:
		print(-1)
		continue
	base = 0
	while n >= 8:
		x = perms[4]
		for y in x:
			print(y + base, end=' ')
		n -= 4
		base += 4
	x = perms[n]
	for y in x:
		print(y + base, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		l = []
		for i in range(n, 0, -1):
			if i % 2 != 0:
				l.append(i)
		l.append(4)
		l.append(2)
		for i in range(6, n + 1, 2):
			l.append(i)
		print(*l)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		s = '3 1 4 2'
		if n == 4:
			print(s)
		elif n % 2 == 0:
			for i in range(5, n + 1, 2):
				s = str(i) + ' ' + s
				s = s + ' ' + str(i + 1)
			print(s)
		else:
			for i in range(5, n, 2):
				s = str(i) + ' ' + s
				s = s + ' ' + str(i + 1)
			s = str(n) + ' ' + s
			print(s)


from collections import deque

def have_per(n):
	if n < 4:
		return []
	elif n == 4:
		return [2, 4, 1, 3]
	else:
		s = deque([2, 4, 1, 3])
		for num in range(5, n + 1):
			if num % 2 == 0:
				s.appendleft(num)
			else:
				s.append(num)
		return s

def main():
	n = int(input())
	for _ in range(n):
		n = int(input())
		res_list = have_per(n)
		if not res_list:
			print(-1)
		else:
			for num in res_list:
				print(num, end=' ')
			print()
main()


from math import *

def solver():
	n = int(input())
	if n in [1, 2, 3]:
		print(-1)
		return
	s = []
	for i in range(n - n % 2, 5, -2):
		s.append(i)
	s.extend([2, 4])
	for i in range(1, n + n % 2, 2):
		s.append(i)
	print(' '.join(map(str, s[::-1])))
for _ in range(int(input())):
	solver()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print('-1')
		continue
	k = 5
	t = '2 4 1 3'
	x = []
	y = []
	while k <= n:
		if k & 1:
			x += [k]
			k += 1
		else:
			y += [k]
			k += 1
	print(''.join([str(i) + ' ' for i in reversed(y)]) + t + ''.join([' ' + str(i) for i in x]))


def solve():
	N = int(input())
	if N <= 3:
		print(-1, end=' ')
		return
	f = N
	if N % 2 == 0:
		f -= 1
	for i in range(f, 0, -2):
		print(i, end=' ')
	print('4 2', end=' ')
	for i in range(6, N + 1, 2):
		print(i, end=' ')

def main():
	T = int(input())
	while T != 0:
		solve()
		print()
		T -= 1
main()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	a = []
	i = 1 if n & 1 else 2
	s = (n + 1) // 2
	while i <= n:
		a.append(i)
		i += 2
	d = [-3, 2, -4, -2]
	c = a[-1]
	i = 0
	while n - s:
		c += d[min(3, i)]
		a.append(c)
		i += 1
		s += 1
	print(*a)


t = int(input())
ns = [int(input()) for _ in range(t)]
for n in ns:
	if n < 4:
		print(-1)
		continue
	half = n // 2
	even = [(i + 1) * 2 for i in range(half)]
	if n % 2 == 1:
		half += 1
	odd = [i * 2 + 1 for i in range(half)]
	if n % 2 == 0:
		(odd[-1], odd[-2]) = (odd[-2], odd[-1])
	else:
		(even[-1], even[-2]) = (even[-2], even[-1])
	ans = odd + even[::-1]
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(-1)
	elif n == 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		if n % 4 == 0:
			repeat = [2, 4, 1, 3]
			for i in range(n):
				repeat_count = i // 4
				print(repeat[i % 4] + repeat_count * 4, end=' ')
			print()
		if n % 4 == 1:
			repeat = [3, 5, 2, 4]
			print(1, end=' ')
			for i in range(1, n):
				repeat_count = (i - 1) // 4
				print(repeat[(i - 1) % 4] + repeat_count * 4, end=' ')
			print()
		if n % 4 == 2:
			repeat = [3, 5, 2, 4]
			print(1, end=' ')
			for i in range(1, n - 1):
				repeat_count = (i - 1) // 4
				print(repeat[(i - 1) % 4] + repeat_count * 4, end=' ')
			print(n)
		if n % 4 == 3:
			result = []
			repeat = [3, 5, 2, 4]
			result.append(1)
			for i in range(1, n - 2):
				repeat_count = (i - 1) // 4
				result.append(repeat[(i - 1) % 4] + repeat_count * 4)
			result.append(n - 1)
			result.insert(n - 5, n)
			for x in result:
				print(x, end=' ')
			print()


from sys import stdout
for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		stdout.write('-1\n')
	else:
		for i in range(2, n + 1, 2):
			stdout.write(str(i) + ' ')
		x = i - 3
		stdout.write(str(x) + ' ')
		for i in range(i + 1 if n & 1 else i - 1, 0, -2):
			if i != x:
				stdout.write(str(i) + ' ')
		stdout.write('\n')


for _ in range(int(input())):
	n = int(input())
	li = [3, 1, 4, 2]
	if n < 4:
		print(-1)
	else:
		for x in range(5, n + 1):
			if x % 2 == 1:
				li = [x] + li[:]
			else:
				li.append(x)
		print(*li)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	mid = [3, 1, 4, 2]
	right = []
	left = []
	turn = 1
	for i in range(n - 4):
		if turn:
			right.append(i + 5)
			turn = 0
		else:
			left.append(i + 5)
			turn = 1
	left.reverse()
	ans = left + mid + right
	print(' '.join((str(i) for i in ans)))


from collections import defaultdict
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	elif n == 4:
		print(3, 1, 4, 2)
		continue
	ANS = [i for i in range(1, n + 1, 2)]
	pos = ANS[-1] - 3
	ANS.append(pos)
	if n % 2 == 0:
		ANS.append(pos + 4)
		ANS.append(pos + 2)
		pos -= 2
	else:
		ANS.append(pos + 2)
		pos -= 2
	while pos > 0:
		ANS.append(pos)
		pos -= 2
	print(*ANS)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	r = []
	if n % 2 == 1:
		for i in range(n, -1, -1):
			if i % 2 == 1:
				r.append(i)
		for i in range(n):
			if i % 2 == 0 and i != 0 and (i != 2):
				r.append(i)
				if i == 4:
					r.append(2)
	else:
		for i in range(n, -1, -1):
			if i % 2 == 1:
				r.append(i)
		for i in range(n + 1):
			if i % 2 == 0 and i != 0 and (i != 2):
				r.append(i)
				if i == 4:
					r.append(2)
	print(*r)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for i in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		a = deque([3, 1, 4, 2])
		for i in range(5, n + 1):
			if i % 2 == 1:
				a.appendleft(i)
			else:
				a.append(i)
		a = list(a)
		print(*a, sep=' ')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		odd = [i for i in range(1, n + 1, 2)]
		eve = [i for i in range(2, n + 1, 2)]
		odd.reverse()
		(eve[0], eve[1]) = (eve[1], eve[0])
		odd += eve
		print(*odd)


from collections import deque
seed = ['3', '1', '4', '2']
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	s = True
	a = deque(seed)
	for i in range(n - 4):
		if s:
			a.appendleft(str(5 + i))
		else:
			a.append(str(5 + i))
		s = not s
	print(' '.join(a))


from collections import defaultdict
for ii in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		arr = []
		start = n if n % 2 != 0 else n - 1
		for i in range(start, -1, -2):
			print(i, end=' ')
		print('4 2', end=' ')
		for i in range(6, n + 1, 2):
			print(i, end=' ')
		print()


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n % 2 == 0:
		xe = n
		xo = n - 1
	else:
		xe = n - 1
		xo = n
	ans = []
	while xo >= 1:
		ans.append(xo)
		xo -= 2
	ans.append(4)
	ans.append(2)
	j = 6
	while j <= xe:
		ans.append(j)
		j += 2
	print(*ans, sep=' ')


def main():
	n = int(input())
	if n <= 3:
		print(-1)
		return
	ans = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			ans.append(i)
		else:
			ans.insert(0, i)
	if n % 2 != 0:
		n += 1
	pos2 = n // 2
	pos4 = pos2 + 1
	(ans[pos2], ans[pos4]) = (ans[pos4], ans[pos2])
	print(*ans)
t = int(input())
for _ in range(t):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	x = n % 2
	if x == 1:
		print(x, end=' ')
	while x < n:
		x += 2
		print(x, end=' ')
	print(x - 3, x - 1, end=' ')
	x = x - 5
	while x > 0:
		print(x, end=' ')
		x -= 2
	print()


k = int(input())
for _ in range(k):
	i = int(input())
	n = i
	if i < 4:
		print(-1)
	elif i % 2 == 0:
		while n - 1 > 0:
			print(n - 1, end=' ')
			n -= 2
		print(4, end=' ')
		print(2, end=' ')
		n = 6
		while n <= i:
			print(n, end=' ')
			n += 2
		print(' ')
	elif i % 2 != 0:
		while n != -1:
			print(n, end=' ')
			n -= 2
		print(4, end=' ')
		print(2, end=' ')
		n = 6
		while n <= i - 1:
			print(n, end=' ')
			n += 2
		print(' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		l = [0] * n
		l[0] = 2
		if n & 1:
			l[n - 1] = n
		n = n // 2
		l[n] = 1
		for i in range(1, n):
			l[n - i - 1] = 2 * (i + 1)
			l[n + i] = 2 * (i + 1) - 1
		l[n - 1] = 4
		l[n - 2] = 2
		print(*l)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	a = [i for i in range(1, n + 1) if i % 2]
	b = [i for i in range(5, n + 1) if not i % 2]
	print(*a[::-1], *[4, 2], *b)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print('-1')
	elif n % 2 == 0:
		res = []
		for i in range(n, 4, -2):
			res.append(i)
		res.append(3)
		res.append(1)
		res.append(4)
		res.append(2)
		for i in range(5, n, 2):
			res.append(i)
		print(' '.join((str(x) for x in res)))
	else:
		res = []
		for i in range(n, 4, -2):
			res.append(i)
		res.append(3)
		res.append(1)
		res.append(4)
		res.append(2)
		for i in range(6, n, 2):
			res.append(i)
		print(' '.join((str(x) for x in res)))


import sys
input = sys.stdin.readline
from collections import deque
t = int(input())
for i in range(0, t):
	n = int(input())
	l = []
	q = deque(l)
	c2 = 0
	c4 = 0
	if n == 2 or n == 3:
		print(-1)
		continue
	for i in range(1, n + 1, 2):
		q.appendleft(i)
	for i in range(2, n + 1, 2):
		q.append(i)
	for i in range(0, len(q)):
		if q[i] == 4:
			c4 = 1
	if c4 == 1:
		for i in range(0, len(q)):
			if q[i] == 2:
				q[i] = 4
			elif q[i] == 4:
				q[i] = 2
	for i in q:
		print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	if n >= 4:
		x = n // 4
		y = n % 4
		if y == 0:
			for j in range(x):
				a.append(2 + 4 * j)
				a.append(4 + 4 * j)
				a.append(1 + 4 * j)
				a.append(3 + 4 * j)
		if y == 1:
			for j in range(x):
				a.append(2 + 4 * j)
				a.append(4 + 4 * j)
				a.append(1 + 4 * j)
				a.append(3 + 4 * j)
			a.append(n)
		if y == 2:
			for j in range(x - 1):
				a.append(2 + 4 * j)
				a.append(4 + 4 * j)
				a.append(1 + 4 * j)
				a.append(3 + 4 * j)
			a.append(2 + 4 * (x - 1))
			a.append(4 + 4 * (x - 1))
			a.append(1 + 4 * (x - 1))
			a.append(n - 1)
			a.append(3 + 4 * (x - 1))
			a.append(n)
		if y == 3:
			for j in range(x - 1):
				a.append(2 + 4 * j)
				a.append(4 + 4 * j)
				a.append(1 + 4 * j)
				a.append(3 + 4 * j)
			a.append(2 + 4 * (x - 1))
			a.append(4 + 4 * (x - 1))
			a.append(1 + 4 * (x - 1))
			a.append(n - 2)
			a.append(n)
			a.append(3 + 4 * (x - 1))
			a.append(n - 1)
		print(*a)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		if n % 2 == 0:
			p = n - 1
		else:
			p = n
		result = ''
		for i in range(p, 0, -2):
			result += str(i) + ' '
		result += '4 2 '
		if n % 2 == 0:
			p = n
		else:
			p = n - 1
		for i in range(6, p + 1, 2):
			result += str(i) + ' '
		print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		if n % 4 == 3:
			print(n, end=' ')
		if n % 4:
			print(n // 4 * 4 + 1, end=' ')
		for t in [3, 1, 4, 2]:
			for i in range(n // 4):
				if t <= 2:
					print(4 * i + t, end=' ')
				else:
					print(4 * (n // 4 - 1 - i) + t, end=' ')
		if n % 4 >= 2:
			print(n // 4 * 4 + 2, end=' ')
		print()


import sys
import math
from collections import defaultdict

def solve(test):
	n = int(input())
	if n < 4:
		print(-1)
		return
	res = []
	s = 1 if n & 1 else 2
	while s <= n:
		res.append(str(s))
		s += 2
	s -= 5
	res.append(str(s))
	s += 2
	res.append(str(s))
	s -= 4
	while len(res) < n:
		res.append(str(s))
		s -= 2
	print(' '.join(res))
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


T = int(input())
for _ in range(0, T):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		L = []
		for tt in range(n // 5):
			i = tt * 5
			L.append(i + 1)
			L.append(i + 3)
			L.append(i + 5)
			L.append(i + 2)
			L.append(i + 4)
		if n % 5 == 1:
			L.append(n)
		elif n % 5 == 2:
			temp = L[-1]
			L[-1] = n - 1
			L.append(temp)
			L.append(n)
		elif n % 5 == 3:
			temp = L[-1]
			L[-1] = n - 2
			L.append(n)
			L.append(temp)
			L.append(n - 1)
		elif n % 5 == 4:
			temp = L[-1]
			L[-1] = n - 3
			L.append(n - 1)
			L.append(temp)
			L.append(n - 2)
			L.append(n)
		print(*L)


for T in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	x = 5
	r1 = []
	while x <= n:
		r1.append(x)
		x += 2
	for x in r1[::-1]:
		print(x, end=' ')
	r1 = []
	x = 6
	while x <= n:
		r1.append(x)
		x += 2
	print('3 1 4 2', *r1)


import collections

def solve(n):
	if n < 4:
		return '-1'
	ans = []
	for i in range(n, 0, -1):
		if i & 1:
			ans.append(i)
	ans.extend([4, 2])
	for i in range(6, n + 1, 2):
		ans.append(i)
	return ' '.join(map(str, ans))
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	print(solve(n))


from collections import deque
for i in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		a = deque([3, 1, 4, 2])
		for i in range(5, n + 1):
			if i % 2 == 1:
				a.appendleft(i)
			else:
				a.append(i)
		a = list(a)
		print(*a, sep=' ')


t = int(input())
for tc in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	odd = list(range(1, n + 1, 2))
	even = list(range(2, n + 1, 2))
	ans = []
	if n % 2 == 0:
		(odd[-2], odd[-1]) = (odd[-1], odd[-2])
		even.reverse()
		ans = odd + even
	else:
		(even[-2], even[-1]) = (even[-1], even[-2])
		odd.reverse()
		ans = even + odd
	print(*ans)


q = int(input())
for o in range(q):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ans = []
	if n % 2 == 1:
		for i in range(n, 0, -2):
			ans.append(i)
		for i in range(2, n, 2):
			ans.append(i)
		for i in range(n):
			if ans[i] == 2:
				ans[i] = 4
				ans[i + 1] = 2
				break
	else:
		for i in range(n - 1, 0, -2):
			ans.append(i)
		for i in range(2, n + 1, 2):
			ans.append(i)
		for i in range(n):
			if ans[i] == 2:
				ans[i] = 4
				ans[i + 1] = 2
				break
	for i in ans:
		print(i, end=' ')
	print()


t = int(input())
for _ in range(t):
	A = []
	n = int(input())
	if n in [2, 3]:
		print(-1)
		continue
	for i in range(n // 4):
		A += [2 + i * 4, 4 + i * 4, 1 + i * 4, 3 + i * 4]
	if n % 4 == 1:
		A.append(n)
	if n % 4 == 2:
		A.append(n - 1)
		A.append(n)
		(A[-3], A[-2]) = (A[-2], A[-3])
	elif n % 4 == 3:
		A.append(n - 2)
		A.append(n - 1)
		A.append(n)
		(A[-4], A[-3]) = (A[-3], A[-4])
		(A[-3], A[-2]) = (A[-2], A[-3])
		(A[-3], A[-1]) = (A[-1], A[-3])
	print(*A)


from sys import stdin
for _ in range(int(stdin.readline())):
	inp = int(stdin.readline())
	if inp < 4:
		print('-1')
	else:
		odd = list(range(5, inp + 1, 2))
		odd.reverse()
		even = list(range(6, inp + 1, 2))
		r = odd + [3, 1, 4, 2] + even
		print(' '.join(map(str, r)))


import os
import sys
from io import BytesIO, IOBase

def solution(n):
	if n < 4:
		write(-1)
		return
	if n & 1:
		res1 = list(range(n, 0, -2))
		res2 = list(range(2, n, 2))
	else:
		res1 = list(range(n - 1, 0, -2))
		res2 = list(range(2, n + 1, 2))
	(res2[0], res2[1]) = (4, 2)
	write(*res1 + res2)

def main():
	for _ in range(r_int()):
		n = r_int()
		solution(n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


n = int(input())

def get_answer(v):
	if v <= 3:
		print(-1)
	elif v == 4:
		print('3 1 4 2')
	elif v == 5:
		print('1 3 5 2 4')
	elif v == 6:
		print('1 3 5 2 6 4')
	elif v % 2 == 1:
		a1 = [str(t) for t in range(1, v + 2, 2)]
		a2 = [str(t) for t in range(v - 5, 0, -2)]
		a = a1 + [str(v - 3), str(v - 1)] + a2
		print(' '.join(a))
	else:
		a1 = [str(t) for t in range(1, v + 1, 2)]
		a2 = [str(t) for t in range(v - 6, 0, -2)]
		a = a1 + [str(v - 4), str(v), str(v - 2)] + a2
		print(' '.join(a))
for _ in range(n):
	v = int(input())
	get_answer(v)


def one_case():
	n = int(input())
	if n < 4:
		print(-1)
		return
	start = n if n % 2 == 1 else n - 1
	a = list(range(start, 0, -2)) + [4, 2]
	if n >= 6:
		a = a + list(range(6, n + 1, 2))
	print(' '.join([str(i) for i in a]))
t = int(input())
for i in range(t):
	one_case()


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	if n % 5 == 0 or n % 5 == 1:
		t = 1
		while c != n:
			print(t, end=' ')
			c += 1
			if t % 5 == 0:
				t -= 3
			else:
				t += 2
	elif n % 5 == 4:
		t = 2
		while c != n:
			print(t, end=' ')
			c += 1
			if t % 5 == 4:
				t -= 3
			else:
				t += 2
	elif n % 5 == 3 or n % 5 == 2:
		if n == 2 or n == 3:
			print(-1)
		else:
			t = n
			co = 1
			while c != n:
				print(t, end=' ')
				c += 1
				if t == 1:
					print('4 2', end=' ')
					c += 2
					t = 6
					co = 0
				elif t == 2:
					print('5 1 3', end=' ')
					c += 3
					t = 7
					co = 0
				elif co == 1:
					t -= 2
				else:
					t += 2
	print('')


import math
for _ in range(int(input())):
	n = int(input())
	l = []
	x = n
	if n <= 3:
		print(-1)
	else:
		for i in range(math.ceil(n / 2)):
			l.append(x)
			x -= 2
		if n % 2 == 0:
			x = 1
			while x <= n:
				l.append(x)
				x += 2
		else:
			x = 2
			while x <= n:
				l.append(x)
				x += 2
		xx = l.index(2)
		yy = l.index(4)
		l[xx] = 4
		l[yy] = 2
		for i in range(n):
			print(l[i], end=' ')
		print()


t = int(input())
while t:
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		ans = [2, 4, 1, 3]
		for i in range(5, n + 1):
			if i % 2 == 1:
				ans.append(i)
			else:
				ans.insert(0, i)
		print(*ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
	elif n <= 3:
		print(-1)
	elif n == 4:
		print(*[3, 1, 4, 2])
	elif n == 5:
		print(*[3, 1, 4, 2, 5])
	elif n == 6:
		print(*[3, 1, 5, 2, 4, 6])
	else:
		x = n // 4
		ans = [2, 4, 1, 3]
		for i in range(x - 1):
			(a, b, c, d) = (ans[-4], ans[-3], ans[-2], ans[-1])
			ans.append(a + 4)
			ans.append(b + 4)
			ans.append(c + 4)
			ans.append(d + 4)
		x = n % 4
		if x == 0:
			print(*ans)
		elif x == 1:
			ans.insert(len(ans) - 1, n)
			print(*ans)
		elif x == 2:
			ans.insert(len(ans) - 1, n - 1)
			ans.append(n)
			print(*ans)
		else:
			ans.insert(len(ans) - 1, n - 2)
			ans.insert(len(ans) - 4, n - 1)
			ans.append(n)
			print(*ans)


for i in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		s = ' 3 1 4 2 '
		f = 0
		for i in range(5, n + 1):
			if f == 0:
				s = ' ' + str(i) + s
				f = 1
			else:
				s = s + str(i) + ' '
				f = 0
		print(s[1:len(s)])


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	n1 = n
	if n == 2 or n == 3:
		print(-1, end=' ')
	elif n == 4:
		print('3 1 4 2', end=' ')
	else:
		if n % 2 == 0:
			n2 = n - 1
			n1 = n
		else:
			n2 = n
			n1 = n - 1
		for i in range(k):
			print(n1, end=' ')
			n1 -= 2
		print('5 1 3', end=' ')
		nx = 7
		while nx <= n2:
			print(nx, end=' ')
			nx += 2
	print()


t = int(input())
flag = True
while flag:
	t -= 1
	if t == 0:
		flag = False
	v = list(map(int, input().strip().split()))[:1]
	ans = []
	if v[0] < 4:
		print('-1')
	else:
		x = v[0] if v[0] % 2 == 1 else v[0] - 1
		while x >= 1:
			print(x, end=' ')
			x -= 2
		print('4 2 ', end='')
		x = 6
		while x <= v[0]:
			print(x, end=' ')
			x += 2
		print()


import math
from collections import Counter, deque
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	n = I()
	a = []
	if n <= 3:
		print(-1)
	else:
		for i in range(2, n + 1, 2):
			a.append(i)
		if n % 2 == 0:
			r = n - 2
		else:
			r = n - 1
		for i in range(r, -1, -2):
			a.append(i + 1)
		if n % 2 == 0:
			(a[n // 2], a[n // 2 + 1]) = (a[n // 2 + 1], a[n // 2])
		else:
			(a[n // 2], a[n // 2 + 1], a[n // 2 + 2]) = (a[n // 2 + 2], a[n // 2], a[n // 2 + 1])
		s(a)


def solution(A):
	return min(A) == 1 and max(A) == len(A) == len(set(A))

def check(a):
	for i in range(len(a) - 1):
		f = a[i] - a[i + 1]
		if abs(f) < 2 or abs(f) > 4:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = []
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		for i in range(1, n + 1, 2):
			a.append(i)
		if n % 2 == 1:
			a.append(n - 3)
			a.append(n - 1)
			for i in range(n - 5, 0, -2):
				a.append(i)
		if n % 2 == 0:
			a.append(n - 4)
			a.append(n)
			a.append(n - 2)
			for i in range(n - 6, 0, -2):
				a.append(i)
		for i in range(len(a)):
			print(a[i], end=' ')
		print()


def per(n):
	if n < 4:
		print(-1)
		return
	l = []
	for i in range(1, n + 1, 2):
		l.append(i)
	l.reverse()
	l.append(4)
	l.append(2)
	for i in range(6, n + 1, 2):
		l.append(i)
	print(*l, sep=' ')
	return
t = int(input())
for i in range(t):
	n = int(input())
	per(n)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	print(*range(n - (n & 1 ^ 1), 0, -2), '4 2', *range(6, n + 1, 2))


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7
from math import ceil
import heapq
for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	s = 1 + int(not n % 2)
	ans = []
	for i in range(s, n + 1, 2):
		ans.append(i)
	ans.append(n - 3)
	ans.append(n - 1)
	for i in range(n - 5, 0, -2):
		ans.append(i)
	print(*ans)


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		li = []
		for i in range(n, 0, -1):
			if i % 2 != 0:
				li.append(i)
		li.append(4)
		li.append(2)
		for i in range(5, n + 1):
			if i % 2 == 0:
				li.append(i)
		print(*li)


import sys
cases = int(sys.stdin.readline())
for _ in range(cases):
	n = int(sys.stdin.readline())
	if n <= 3:
		print(-1)
	else:
		mid = [3, 1, 4, 2]
		evens = list(range(6, n + 1, 2))[::-1]
		odds = list(range(5, n + 1, 2))
		print(' '.join(map(str, evens + mid + odds)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = []
	na = n
	if n > 3:
		for ii in range(int(n / 5) - 1):
			l.append(na)
			na -= 2
			l.append(na)
			na -= 2
			l.append(na)
			na += 3
			l.append(na)
			na -= 2
			l.append(na)
			na -= 2
		x = n % 5 + 5
		if x == 5:
			l = l + [4, 2, 5, 3, 1]
		elif x == 6:
			l = l + [5, 3, 6, 2, 4, 1]
		elif x == 7:
			l = l + [5, 1, 3, 6, 2, 4, 7]
		elif x == 8:
			l = l + [8, 5, 1, 3, 6, 2, 4, 7]
		else:
			l = l + [9, 7, 4, 2, 6, 3, 1, 5, 8]
		if n == 4:
			l = [3, 1, 4, 2]
		print(' '.join(map(str, l)))
	else:
		print(-1)


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n > 4:
		p = list(range(1, n + 1))
		o = p[::2]
		e = p[1::2]
		(e[-1], e[-2]) = (e[-2], e[-1])
		if n & 1 == 0:
			(e[-1], e[-3]) = (e[-3], e[-1])
		ans = o + e[::-1]
		print(*ans)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	temp = []
	if n < 4:
		print('-1')
		continue
	for i in range(n, 0, -1):
		if i & 1:
			temp.append(i)
	temp.append(4)
	temp.append(2)
	for i in range(6, n + 1, 2):
		temp.append(i)
	print(*temp)


T = int(input())
for t in range(T):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	res = [i for i in range(1, n + 1) if i % 2 == 1][::-1]
	res.append(4)
	res.append(2)
	for i in range(6, n + 1):
		if i % 2 == 0:
			res.append(i)
	print(' '.join(map(str, res)))


for t in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		a = list(range(1, n + 1, 2))[::-1] + [4, 2] + list(range(6, n + 1, 2))
		print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	if n >= 4:
		if n % 4 < 2:
			for i in range(0, n - 1, 4):
				print(str(2 + i) + ' ' + str(4 + i) + ' ' + str(1 + i) + ' ' + str(3 + i), end=' ')
			if n % 4 == 1:
				print(n)
			else:
				print()
		elif n % 4 == 2:
			for i in range(0, n - 8, 4):
				print(str(2 + i) + ' ' + str(4 + i) + ' ' + str(1 + i) + ' ' + str(3 + i), end=' ')
			print(str(n - 5) + ' ' + str(n - 2) + ' ' + str(n - 4) + ' ' + str(n) + ' ' + str(n - 3) + ' ' + str(n - 1))
		else:
			for i in range(0, n - 8, 4):
				print(str(2 + i) + ' ' + str(4 + i) + ' ' + str(1 + i) + ' ' + str(3 + i), end=' ')
			print(str(n - 4) + ' ' + str(n) + ' ' + str(n - 2) + ' ' + str(n - 5) + ' ' + str(n - 1) + ' ' + str(n - 3) + ' ' + str(n - 6))
	else:
		print(-1)


import math

def r():
	return map(int, input().split())

def lis():
	return list(map(int, input().split()))

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = int(input())
for i in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		res = '3 1 4 2'
		for i in range(5, n + 1):
			if i % 2 == 1:
				res = res + ' ' + str(i)
			else:
				res = str(i) + ' ' + res
		print(res)


T = int(input())
for t in range(T):
	a = int(input())
	if a <= 3:
		print('-1')
		continue
	if a % 4 == 0:
		now = [2, 4, 1, 3]
	elif a % 4 == 1:
		now = [3, 1, 5, 2, 4]
	elif a % 4 == 2:
		now = [1, 4, 2, 6, 3, 5]
	elif a % 4 == 3:
		now = [5, 1, 3, 6, 2, 4, 7]
	a -= a % 4
	a -= 4
	v = len(now) + 1
	for i in range(a // 4):
		now.extend([v + 1, v + 3, v, v + 2])
		v += 4
	ans = ''
	for c in now:
		ans += str(c) + ' '
	ans = ans[:-1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		m = n // 4 * 4
		permutation = []
		even = 2
		odd = 1
		flag = 0
		while m:
			if flag == 0:
				permutation.extend([even, even + 2])
				even += 4
				flag = 1
			else:
				permutation.extend([odd, odd + 2])
				odd += 4
				flag = 0
			m -= 2
		if n % 4 == 0:
			print(*permutation)
		elif n % 4 == 1:
			permutation.append(n)
			print(*permutation)
		elif n % 4 == 2:
			permutation.extend([n - 1, n])
			(permutation[-3], permutation[-2]) = (permutation[-2], permutation[-3])
			print(*permutation)
		elif n % 4 == 3:
			permutation.extend([n, n - 2, n - 1])
			(permutation[-4], permutation[-2]) = (permutation[-2], permutation[-4])
			print(*permutation)


t = int(input())

def fun(a):
	a = []
	if n < 4:
		print(-1)
	else:
		a = [2, 4, 1, 3]
		for i in range(5, n + 1):
			if i % 2 == 1:
				a.append(i)
			else:
				a = [i] + a
		print(*a, sep=' ')
while t:
	t -= 1
	n = int(input())
	fun(n)


for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		i = 1
		arr1 = [int(x) for x in range(1, n + 1, 2)]
		arr2 = [int(x) for x in range(2, n + 1, 2)]
		if n % 2 == 0:
			(arr1[-1], arr1[-2]) = (arr1[-2], arr1[-1])
			print(*arr1 + arr2[::-1])
		else:
			(arr2[-1], arr2[-2]) = (arr2[-2], arr2[-1])
			print(*arr2 + arr1[::-1])


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 3:
		print(-1)
	else:
		final1 = []
		final2 = []
		ans = [3, 1, 4, 2]
		k = 5
		yo = 3
		yo1 = 2
		for i in range(n - 4):
			if 2 <= abs(k - yo) <= 4:
				yo = k
				final1.append(k)
			elif 2 <= abs(k - yo1) <= 4:
				yo1 = k
				final2.append(k)
			k += 1
		final1.reverse()
		fin = []
		fin += final1 + ans + final2
		print(*fin)


t = int(input())
for tests in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		st = n
		if st % 2 == 1:
			st -= 1
		while st >= 6:
			print(st, end=' ')
			st -= 2
		print('3 1 4 2', end='')
		st = 5
		while st <= n:
			print(' %d' % st, end='')
			st += 2
		print()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	num = []
	for i in range(t):
		n = int(input())
		num.append(n)
	for n in num:
		ans = [3, 1, 4, 2]
		if n <= 3:
			print(-1)
			continue
		if n == 4:
			print(' '.join([str(x) for x in ans]))
			continue
		for x in range(1, n - 3):
			if x % 2 == 1:
				ans.insert(0, 4 + x)
			else:
				ans.append(4 + x)
		print(' '.join([str(x) for x in ans]))
main()


tests = int(input())
while tests:
	n = int(input())
	if n < 4:
		print(-1)
	else:
		(s1, s2) = ('', '')
		for i in range(n, 0, -1):
			if i & 1:
				s1 = s1 + str(i) + ' '
		for i in range(6, n + 1, 2):
			s2 = s2 + str(i) + ' '
		print(s1 + '4 2 ' + s2)
	tests -= 1


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		tabl = [2, 4, 1, 3]
		i = 5
		while i <= n:
			if i % 2 == 1:
				tabl.append(i)
			else:
				tabl.reverse()
				tabl.append(i)
				tabl.reverse()
			i += 1
		print(*tabl)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		l = []
		if n % 2 == 0:
			for i in range(n - 1, 0, -2):
				l.append(i)
			l.append(4)
			l.append(2)
			for j in range(6, n + 1, 2):
				l.append(j)
		else:
			for i in range(n, 0, -2):
				l.append(i)
			l.append(4)
			l.append(2)
			for j in range(6, n, 2):
				l.append(j)
		for i in l:
			print(i, end=' ')
		print()


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	out = []
	if n <= 3:
		print(-1)
	else:
		for i in range(n, 0, -1):
			if i % 2 != 0:
				out.append(i)
		ind = len(out)
		for i in range(1, n + 1):
			if i % 2 == 0:
				out.append(i)
		(out[ind], out[ind + 1]) = (out[ind + 1], out[ind])
		print(*out)


a = int(input())
for _ in range(a):
	b = int(input())
	if b < 4:
		print(-1)
	elif b == 4:
		print(2, 4, 1, 3)
	elif b == 5:
		print(5, 2, 4, 1, 3)
	elif b == 6:
		print(5, 2, 4, 1, 3, 6)
	elif b % 2 == 1:
		for i in range(b, 4, -2):
			print(i, end=' ')
		print(2, end=' ')
		print(4, end=' ')
		print(1, end=' ')
		print(3, end=' ')
		for j in range(6, b - 1, 2):
			print(j, end=' ')
		print(b - 1, end='\n')
	else:
		for i in range(b - 1, 4, -2):
			print(i, end=' ')
		print(2, end=' ')
		print(4, end=' ')
		print(1, end=' ')
		print(3, end=' ')
		for j in range(6, b - 1, 2):
			print(j, end=' ')
		print(b, end='\n')


import math
import bisect
t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	if n < 4:
		print('-1')
	else:
		for i in range(n, 0, -1):
			if i % 2 != 0:
				arr.append(i)
		arr.append(4)
		for i in range(1, n + 1):
			if i % 2 == 0 and i != 4:
				arr.append(i)
		print(*arr)


a = int(input())
for i in range(a):
	s = int(input())
	if s == 2 or s == 3:
		print(-1)
		continue
	if s % 2 == 1:
		ans = [1]
		while ans[-1] != s:
			ans.append(ans[-1] + 2)
		ans.append(ans[-1] - 3)
		ans.append(ans[-1] + 2)
		if len(ans) == s:
			print(*ans)
			continue
		ans.append(ans[-1] - 4)
		while ans[-1] != 2:
			ans.append(ans[-1] - 2)
		print(*ans)
	else:
		ans = [2]
		while ans[-1] != s:
			ans.append(ans[-1] + 2)
		ans.append(ans[-1] - 3)
		ans.append(ans[-1] + 2)
		if len(ans) == s:
			print(*ans)
			continue
		ans.append(ans[-1] - 4)
		while ans[-1] != 1:
			ans.append(ans[-1] - 2)
		print(*ans)


from collections import deque
for i in range(int(input())):
	n = int(input())
	q = deque([])
	if n == 2 or n == 3:
		print(-1)
		continue
	q.append(n)
	q.appendleft(n - 3)
	q.appendleft(n - 1)
	q.append(n - 2)
	n -= 4
	while n > 1:
		q.appendleft(n)
		q.append(n - 1)
		n -= 2
	if n == 1:
		q.appendleft(1)
	print(*q)


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_right, bisect_left
from fractions import Fraction

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	if n == 4:
		print('3 1 4 2')
		continue
	if n < 5:
		print(-1)
		continue
	a = [i for i in range(1, n + 699, 2)]
	b = [i + 1 for i in range(1, n + 699, 2)]
	(i, j) = (0, 0)
	turn = 0
	i = 3
	x = [1, 3, 5]
	while len(x) < n + 3:
		x += [b[j], b[j + 1]]
		j += 2
		x += [a[i], a[i + 1]]
		i += 2
	ans = []
	for i in x:
		if i <= n:
			ans += [i]
	a = list(ans)
	if n % 4 == 0:
		(a[-4], a[-3], a[-2], a[-1]) = (a[-2], a[-1], a[-4], a[-3])
	if n % 4 == 3:
		(a[-3], a[-2], a[-1]) = (a[-1], a[-3], a[-2])
	print(' '.join((str(k) for k in a)))


for _ in range(int(input())):
	n = int(input())
	ans = []
	if n < 4:
		print(-1)
	else:
		ans = list(range(n + (n % 2 - 1), 0, -2))
		ans.append(4)
		ans.append(2)
		if n >= 6:
			ans += list(range(6, n + 1, 2))
	print(*ans)


import os
import sys
from io import BytesIO, IOBase
import threading
from math import floor
from bisect import bisect_right
from collections import deque
from math import gcd
mod = 998244353

def main():
	for i in range(int(input())):
		n = int(input())
		shif = 0
		k = n // 4
		ans = []
		d = [2, 4, 1, 3]
		d1 = [1, 3, 5, 2, 6, 4]
		d2 = [1, 4, 7, 3, 5, 2, 6]
		if k == 0:
			print(-1)
		else:
			for i in range(k - 1):
				for dif in d:
					ans.append(shif * 4 + dif)
				shif += 1
			m = n - (k - 1) * 4
			if m == 7:
				for dif in d2:
					ans.append(shif * 4 + dif)
			elif m == 6:
				for dif in d1:
					ans.append(shif * 4 + dif)
			else:
				for dif in d:
					ans.append(shif * 4 + dif)
			if m == 5:
				ans.append(shif * 4 + 5)
		print(' '.join([str(i) for i in ans]))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def adv4(num):
	return [num + 2, num, num + 3, num + 1, num + 4]

def adv5(num):
	return [num + 3, num + 1, num + 4, num + 2, num + 5]

def adv6(num):
	return [num + 4, num + 2, num + 5, num + 1, num + 3, num + 6]

def adv7(num):
	return [num + 4, num + 2, num + 6, num + 3, num + 1, num + 5, num + 7]

def adv8(num):
	return [num + 3, num + 7, num + 4, num + 1, num + 5, num + 2, num + 6, num + 8]

def solve():
	n = int(input())
	sequence = []
	if n < 4:
		return [-1]
	elif n == 4:
		return [2, 4, 1, 3]
	curr = 1
	if n % 5 == 1:
		sequence.append(1)
		sequence.extend(adv5(curr))
		curr += 5
	elif n % 5 == 2:
		sequence.append(1)
		sequence.extend(adv6(curr))
		curr += 6
	elif n % 5 == 3:
		sequence.append(1)
		sequence.extend(adv7(curr))
		curr += 7
	elif n % 5 == 4:
		sequence.append(1)
		sequence.extend(adv8(curr))
		curr += 8
	else:
		sequence.extend(adv4(curr))
		curr += 4
	while curr < n:
		sequence.extend(adv5(curr))
		curr += 5
	return sequence
T = int(input())
for i in range(T):
	print(*solve())


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
fast_print = stdout.write
T = int(input())
for _ in range(T):
	n = int(input())
	if n <= 3:
		fast_print('-1\n')
	elif n == 4:
		fast_print('2 4 1 3\n')
	else:
		for i in range(n - n % 2, 0, -2):
			fast_print(str(i) + ' ')
		fast_print('5 1 3 ')
		for i in range(7, n + 1, 2):
			fast_print(str(i) + ' ')
		fast_print('\n')


T = int(input())
for _ in range(T):
	N = int(input())
	if N < 4:
		print(-1)
	else:
		d = []
		for i in range(N // 2, 2, -1):
			d.append(2 * i)
		d.append(3)
		d.append(1)
		d.append(4)
		d.append(2)
		for i in range(2, N // 2):
			d.append(2 * i + 1)
		if N % 2 != 0:
			d.append(N)
		print(*d)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 6:
		if n <= 3:
			print('-1')
		elif n == 4:
			print('3 1 4 2')
		elif n == 5:
			print('1 3 5 2 4')
		else:
			print('1 3 5 2 4 6')
		continue
	l = 1
	if n % 2 == 1:
		while l != n:
			print(l, end=' ')
			l += 2
		l = n - 3
		print(n, l, l + 2, end=' ')
		l -= 2
		while l != 2:
			print(l, end=' ')
			l -= 2
	else:
		while l != n - 1:
			print(l, end=' ')
			l += 2
		print(n - 1, n - 4, end=' ')
		l = n
		while l != 2:
			if l != n - 4:
				print(l, end=' ')
			l -= 2
	print(2)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n < 4:
		print(-1)
	else:
		odd = [int(i) for i in range(1, n + 1, 2)]
		even = [int(i) for i in range(2, n + 1, 2)]
		even[0] = 4
		even[1] = 2
		print(*odd[::-1], *even)


t = int(input())
for i in range(t):
	n = int(input())
	res = []
	if n < 4:
		print(-1)
	elif n % 2:
		for j in range(1, n + 1, 2):
			res.append(j)
		res.append(n - 3)
		res.append(n - 1)
		for j in range(n - 5, 0, -2):
			res.append(j)
		print(' '.join([str(k) for k in res]))
	else:
		for j in range(2, n + 1, 2):
			res.append(j)
		res.append(n - 3)
		res.append(n - 1)
		for j in range(n - 5, 0, -2):
			res.append(j)
		print(' '.join([str(k) for k in res]))


for _ in range(int(input())):
	x = int(input())
	l = []
	if x < 4:
		print(-1)
	else:
		if x % 2 == 0:
			for i in range(2, x + 1, 2):
				l.append(i)
			l.append(x - 3)
			l.append(x - 1)
			for i in range(x - 5, 0, -2):
				l.append(i)
		else:
			for i in range(1, x + 1, 2):
				l.append(i)
			l.append(x - 3)
			l.append(x - 1)
			for i in range(x - 5, 0, -2):
				l.append(i)
		print(*l)


for i in range(int(input())):
	n = int(input())
	g = []
	d = []
	for j in range(1, n + 1):
		g.append(j) if j % 2 else d.append(j)
	g = g[::-1]
	g = g + [4, 2] + d[2:]
	if n < 4:
		print(-1)
	else:
		print(*g)


t = int(input())
for tests in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		for i in range(max(0, n // 5 - 1) * 5):
			y = i % 5
			if y == 0:
				print(i // 5 * 5 + 1, end=' ')
			if y == 1:
				print(i // 5 * 5 + 3, end=' ')
			if y == 2:
				print(i // 5 * 5 + 5, end=' ')
			if y == 3:
				print(i // 5 * 5 + 2, end=' ')
			if y == 4:
				print(i // 5 * 5 + 4, end=' ')
		if n % 5 == 0:
			print(n - 4, n - 2, n, n - 3, n - 1)
		elif n % 5 == 1:
			print(n - 5, n - 3, n - 1, n - 4, n - 2, n)
		elif n % 5 == 2:
			print(n - 6, n - 4, n - 1, n - 5, n - 3, n, n - 2)
		elif n % 5 == 3:
			print(n - 7, n - 4, n, n - 3, n - 6, n - 2, n - 5, n - 1)
		else:
			print(n - 8, n - 6, n - 4, n - 7, n - 5, n - 2, n, n - 3, n - 1)


T = int(input())
for t in range(T):
	N = int(input())
	if N < 4:
		print(-1)
		continue
	if N == 4:
		print('3 1 4 2')
		continue
	if N == 5:
		print('1 3 5 2 4')
		continue
	answer = []
	if N % 2 == 1:
		for i in range(1 + N // 2):
			answer.append(i * 2 + 1)
		last = answer[-1]
		answer.append(last - 3)
		answer.append(last - 1)
		n = last - 5
		while len(answer) < N:
			answer.append(n)
			n -= 2
	else:
		for i in range(N // 2):
			answer.append(i * 2 + 1)
		last = answer[-1]
		answer.append(last - 3)
		answer.append(last + 1)
		answer.append(last - 1)
		n = last - 5
		while len(answer) < N:
			answer.append(n)
			n -= 2
	print(' '.join(map(str, answer)))


from sys import stdin
for case in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n <= 3:
		print(-1)
		continue
	arr = []
	if n % 2 == 0:
		for x in range(2, n + 1, 2):
			arr.append(str(x))
		arr.append(str(n - 3))
		arr.append(str(n - 1))
		for x in range(n - 5, 0, -2):
			arr.append(str(x))
	else:
		for x in range(1, n + 1, 2):
			arr.append(str(x))
		arr.append(str(n - 3))
		arr.append(str(n - 1))
		for x in range(n - 5, 1, -2):
			arr.append(str(x))
	print(' '.join(arr))


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
			continue
		res = [i for i in range(1, n + 1)[::-1] if i & 1]
		res += [4, 2]
		res += [i for i in range(6, n + 1) if i & 1 == 0]
		print(' '.join(map(str, res)))
main()


for _ in range(int(input())):
	n = int(input())
	ls = []
	if n < 4:
		print(-1)
		continue
	tmp = n
	if n & 1 ^ 1:
		tmp -= 1
	d = dict()
	for i in range(1, n + 1):
		d[i] = 0
	while tmp >= 1:
		ls.append(tmp)
		d[tmp] = 1
		tmp -= 2
	ls.append(4)
	ls.append(2)
	d[4] = 1
	d[2] = 1
	for i in range(1, n + 1):
		if d[i] == 0:
			ls.append(i)
	print(*ls)


t = input()
t = int(t)
while t > 0:
	n = input()
	n = int(n)
	if n > 3:
		permutation = [3, 1, 4, 2]
		for i in range(5, n + 1):
			if i % 2 == 0:
				permutation.insert(0, i)
			else:
				permutation.append(i)
		for k in range(len(permutation)):
			print(permutation[k], '\r')
	else:
		print(-1)
	t -= 1


for t in range(int(input())):
	n = int(input())
	l = [2, 4, 1, 3]
	pos = 0
	if n < 4:
		print('-1')
	else:
		for i in range(5, n + 1):
			if pos == 0:
				l.insert(pos, i)
			else:
				l.append(i)
			pos = -(1 + pos)
		for i in l:
			print(i, end=' ')
		print('')


import sys, math
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		j = 1
		while j < n:
			print(j, end=' ')
			j += 2
		if j == n:
			print(j, j - 3, j - 1, end=' ')
		else:
			j -= 2
			print(j - 3, j + 1, j - 1, end=' ')
		j -= 5
		while j > 0:
			print(j, end=' ')
			j -= 2


from sys import stdin, stdout
import math
import collections
input = stdin.readline

def print(x='', end='\n'):
	stdout.write(str(x) + end)

def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	l = [3, 1, 4, 2]
	l = collections.deque(l)
	for i in range(5, n + 1):
		if i % 2:
			l.appendleft(i)
		else:
			l.append(i)
	for i in l:
		print(i, end=' ')
	print()
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


from math import gcd, ceil
from collections import Counter, deque
from heapq import heappush, heappop, heapify

def rl():
	return list(map(int, input().split()))

def arp(arr):
	return ' '.join([str(i) for i in arr])
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		eve = []
		odd = []
		for i in range(1, n + 1):
			if i & 1:
				odd.append(i)
			else:
				eve.append(i)
		odd = odd[::-1]
		(eve[0], eve[1]) = (eve[1], eve[0])
		print(arp(odd + eve))


import sys
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	if n % 2 == 0:
		for i in range(0, int(n / 2)):
			print((i + 1) * 2, end=' ')
		print(n - 3, end=' ')
		print(n - 1, end=' ')
		for i in range(n - 5, 0, -1):
			if i % 2 == 1:
				print(i, end=' ')
		print()
	else:
		for i in range(1, n + 1):
			if i % 2 == 1:
				print(i, end=' ')
		print(n - 3, end=' ')
		print(n - 1, end=' ')
		for i in range(n - 5, 0, -1):
			if i % 2 == 0:
				print(i, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ansl = []
	pr = n
	if pr % 2 == 0:
		pr = pr - 1
	while pr >= 1:
		if pr % 2 == 1:
			ansl.append(pr)
		pr -= 2
	ansl.append(4)
	ansl.append(2)
	for i in range(6, n + 1):
		if i % 2 == 0:
			ansl.append(i)
	print(*ansl)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	n = int(input())
	ans = []
	if n > 3:
		if n == 4:
			ans.append(3)
			ans.append(1)
			ans.append(4)
			ans.append(2)
		else:
			i = 1
			while i <= n:
				ans.append(i)
				i += 2
			if n % 2 == 0:
				j = ans[-1]
				j1 = ans[-2] - 1
				ans.append(ans[-2] - 1)
				ans.append(j + 1)
				j = ans[-1] - 2
				while j >= 2:
					if j != j1:
						ans.append(j)
					j -= 2
			else:
				j = ans[-2] - 1
				ans.append(ans[-2] - 1)
				j1 = j
				ans.append(j + 2)
				while j >= 2:
					if j != j1:
						ans.append(j)
					j -= 2
		print(*ans)
	else:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	oddn = 0
	evenn = 0
	if n < 4:
		print('-1')
		continue
	if n % 2 == 0:
		oddn = n - 1
		evenn = n + 1
	elif n % 2 != 0:
		oddn = n
		evenn = n
	for j in range(oddn, 0, -2):
		arr.append(j)
	arr.append(4)
	arr.append(2)
	for j in range(6, evenn, 2):
		arr.append(j)
	print(*arr)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		if n < 4:
			rr.append(-1)
		else:
			t = [4, 2]
			u = [1, 3]
			for i in range(5, n + 1):
				if i % 2 == 1:
					t.append(i)
				else:
					u.append(i)
			rr.append(JA(u[::-1] + t, ' '))
	return JA(rr, '\n')
print(main())


T = int(input())
for i in range(1, T + 1):
	N = int(input())
	L = [9, 7, 3, 1, 5, 2, 4, 6, 8, 10]
	if N > 10:
		for j in range(11, N + 1):
			if j % 2 == 1:
				L.insert(0, j)
			else:
				L.append(j)
		print(' '.join((str(x) for x in L)))
	elif N <= 3:
		print(-1)
	elif N == 4:
		print('3 1 4 2')
	elif N == 5:
		print('5 3 1 4 2')
	elif N == 6:
		print('5 3 1 4 2 6')
	elif N == 7:
		print('7 5 3 1 4 2 6')
	elif N == 8:
		print('7 5 3 1 4 2 6 8')
	elif N == 9:
		print('9 7 5 3 1 4 2 6 8')
	elif N == 10:
		print('9 7 5 3 1 4 2 6 8 10')


import sys, math, cmath, time
from collections import defaultdict
start_time = time.time()
tt = 0

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	if n > 3:
		q = []
		w = []
		for i in range(n):
			if i % 2 == 1:
				w.append(i + 1)
			else:
				q.append(i + 1)
		w.insert(1, w.pop(0))
		print(*list(reversed(q)) + w)
	else:
		print(-1)

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


from sys import stdin
input = stdin.readline
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
for i in range(it()):
	a = it()
	if a <= 3:
		print(-1)
	elif a == 4:
		print(2, 4, 1, 3)
	else:
		k = a - 3
		for i in range(2, a + 1, 2):
			print(i, end=' ')
		if a & 1:
			k -= 1
		else:
			a -= 1
		print(k, end=' ')
		for j in range(a, -1, -2):
			if j != k:
				print(j, end=' ')
		print()


t = int(input())
for z in range(t):
	n = int(input())
	ans = []
	if n == 2 or n == 3:
		print('-1')
	elif n == 4:
		print(2, 4, 1, 3)
	else:
		for i in range(2 - n % 2, n + 1, 2):
			ans.append(i)
		ans.extend([n - 3, n - 1])
		for i in range(n - 5, 0, -2):
			ans.append(i)
		print(*ans)


for case in range(int(input())):
	n = int(input())
	ans = ''
	odd = ''
	even = ''
	connect = '4 2 '
	flag = 0
	for x in range(n, 0, -1):
		if n < 4:
			flag = 1
		if x % 2 == 1:
			odd += str(x) + ' '
		else:
			even += str(x) + ' '
	even = list(reversed(even.split()))
	even = even[2:]
	if flag == 0:
		ans = odd + connect
		even = ' '.join(even)
		ans += even
		print(ans)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	even = []
	odd = []
	if n == 2 or n == 3:
		print(-1)
		continue
	for i in range(1, n + 1):
		if i % 2 == 1:
			odd.append(i)
		else:
			even.append(i)
	for i in range(len(odd) - 1, -1, -1):
		print(odd[i], end=' ')
	(even[0], even[1]) = (even[1], even[0])
	for i in range(len(even)):
		print(even[i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if n > 3 and n < 8:
		ans = [0] * (n + 1)
		if n % 2 == 0:
			for i in range(1, x + 1):
				ans[2 * i] = i
				ans[2 * i - 1] = x + i
		else:
			for i in range(1, x + 1):
				ans[2 * i] = i
				ans[2 * i - 1] = x + i
			ans[-1] = n
		del ans[0]
		print(' '.join(map(str, ans)))
	elif n >= 8:
		if n % 2 == 0:
			e = [2 * i for i in range(1, x + 1)]
			o = [2 * (x - i) - 1 for i in range(x)]
			(o[-1], o[-2], o[-3]) = (o[-3], o[-1], o[-2])
			ans = o + e
		else:
			e = [2 * i for i in range(1, x + 1)]
			o = [2 * (x - i) - 1 for i in range(x)]
			(o[-1], o[-2], o[-3]) = (o[-3], o[-1], o[-2])
			ans = [n] + o + e
		print(' '.join(map(str, ans)))
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	ans = []
	start = 1 if n & 1 else 2
	for i in range(start, n + 1, 2):
		ans.append(i)
	ans.append(n - 3)
	ans.append(n - 1)
	for i in range(n - 5, 0, -2):
		ans.append(i)
	print(*ans)


T = int(input())
while T > 0:
	N = int(input())
	if N < 4:
		print(-1)
	elif N == 4:
		print('3 1 4 2')
	elif N == 5:
		print('3 1 4 2 5')
	elif N == 6:
		print('5 3 1 4 2 6')
	elif N % 2 == 0:
		print(*range(N, 6, -2), '6 2 4 1 3 5', *range(7, N + 1, 2))
	else:
		print(*range(N, 5, -2), '5 3 1 4 2 6', *range(8, N + 1, 2))
	T -= 1


n = int(input())
for x in range(n):
	k = int(input())
	if k < 4:
		print(-1)
	elif k == 4:
		print('2 4 1 3')
	elif k == 5:
		print('2 4 1 3 5')
	else:
		if k % 2 == 0:
			for tl in range(k // 2):
				if tl < k // 2 - 2:
					print(k - 2 * tl, end=' ')
				elif tl == k // 2 - 2:
					print(2, end=' ')
				else:
					print(4, end=' ')
			for tq in range(k // 2):
				print(1 + 2 * tq, end=' ')
		else:
			for tl in range(k // 2):
				if tl < k // 2 - 2:
					print(k - 2 * tl - 1, end=' ')
				elif tl == k // 2 - 2:
					print(2, end=' ')
				else:
					print(4, end=' ')
			for tq in range(k // 2 + 1):
				print(1 + 2 * tq, end=' ')
		print()


def Zs():
	return list(map(int, input().split()))

def Z():
	return int(input())

def solve(n):
	if n <= 3:
		return None
	ans = []
	k = 1
	while n >= 8:
		ans.extend([k + 1, k + 3, k, k + 2])
		n -= 4
		k += 4
	if n == 4:
		ans.extend([x + k for x in [2, 0, 3, 1]])
	elif n == 5:
		ans.extend([x + k for x in [2, 0, 4, 1, 3]])
	elif n == 6:
		ans.extend([x + k for x in [2, 0, 4, 1, 3, 5]])
	else:
		ans.extend([x + k for x in [2, 0, 4, 1, 5, 3, 6]])
	return ans
for _ in range(Z()):
	n = Z()
	ans = solve(n)
	if ans is not None:
		print(*ans)
	else:
		print(-1)


def arrange(N):
	l = []
	f = []
	if N == 1:
		return [-1]
		return
	if N == 2 or N == 3:
		return [-1]
	even = -1
	odd = -1
	if N % 2 == 0:
		even = N
		odd = N - 1
	else:
		odd = N
		even = N - 1
	while odd >= 1:
		l.append(odd)
		odd = odd - 2
	while even >= 2:
		f.append(even)
		even = even - 2
	ans = l + sorted(f)
	return ans
for u in range(int(input())):
	n = int(input())
	x = arrange(n)
	if x == [-1]:
		print(-1)
	else:
		i = x.index(2)
		j = x.index(4)
		(x[i], x[j]) = (x[j], x[i])
		print(*x)


from sys import stdin, stdout
from itertools import accumulate
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n <= 3:
		print(-1)
		continue
	a = [3, 1, 4, 2]
	last = 5
	while last <= n:
		if last & 1:
			a += [last]
		else:
			a = [last] + a
		last += 1
	print(*a)


for _ in range(int(input())):
	n = int(input())
	st = ''
	if n < 4:
		print(-1)
	else:
		if n % 2 == 1:
			start = n
		else:
			start = n - 1
		for i in range(start, -1, -2):
			st = st + str(i) + ' '
		st += '4 2 '
		for i in range(6, n + 1, 2):
			st = st + str(i) + ' '
		print(st)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	p = n
	if n < 4:
		print(-1)
		continue
	if n % 2 != 0:
		start = n
	else:
		start = n - 1
	l = []
	while start != -1:
		l.append(start)
		start -= 2
	l.append(4)
	l.append(2)
	start = 6
	while start <= p:
		l.append(start)
		start += 2
	print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	if n & 1:
		a = [str(1 + 2 * i) for i in range(n // 2 + 1)]
	else:
		a = [str(1 + 2 * i) for i in range(n // 2)]
	b = [str(2 * i) for i in range(n // 2, 0, -1)]
	(b[-1], b[-2]) = (b[-2], b[-1])
	ans = b + a
	print(' '.join(ans))


def builder(n):
	if n < 4:
		return [-1]
	else:
		lst = list()
		for i in range(n, -1, -1):
			if i % 2 != 0:
				lst.append(i)
		lst.append(4)
		lst.append(2)
		for i in range(6, n + 1, 2):
			lst.append(i)
		return lst
for _ in range(int(input())):
	m = int(input())
	print(*builder(m))


template = [3, 1, 4, 2, 5]
template04 = [3, 1, 4, 2, 5]
template12 = [4, 1, 5, 2, 6, 3, 7]
template3 = [3, 1, 4, 2, 6, 8, 5, 7]
count = int(input())
for i in range(count):
	number = int(input())
	res = []
	if number <= 3:
		res.append(-1)
	else:
		copy_count = number // 5
		last_temp = number % 5
		last_template = template
		if last_temp == 0 or last_temp == 4:
			last_template = template04
		elif last_temp == 1 or last_temp == 2:
			last_template = template12
			copy_count -= 1
		else:
			last_template = template3
			copy_count -= 1
		counter = 0
		while counter < copy_count * 5:
			res.append(template[counter % 5] + counter // 5 * 5)
			counter += 1
		final_counter = 0
		while counter + final_counter < number:
			res.append(last_template[final_counter] + counter)
			final_counter += 1
	for j in range(len(res)):
		print(res[j], end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	(a, b, c, d, l, s) = (0, 0, 0, 0, [], [])
	for (i, j) in enumerate(range(n), start=1):
		if i % 2 == 0:
			l.append(i)
		else:
			s.append(i)
	ln = len(l)
	ln2 = len(s)
	lt = l[::-1]
	if n > 3:
		if n == 5:
			print(*s + l)
		elif n % 2 == 0:
			(s[ln2 - 1], s[ln2 - 2]) = (s[ln2 - 2], s[ln2 - 1])
			print(*s + lt)
		else:
			(lt[0], lt[1]) = (lt[1], lt[0])
			print(*s + lt)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	(b, c) = ([], [])
	if n == 2 or n == 3:
		print(-1)
		continue
	if n == 4:
		a = [3, 1, 4, 2]
		print(*a)
		continue
	if n == 5:
		a = [4, 2, 5, 1, 3]
		print(*a)
		continue
	a = [6, 4, 2, 5, 1, 3]
	for i in range(7, n + 1):
		if i % 2 == 0:
			b.append(i)
		if i % 2 == 1:
			c.append(i)
	b.reverse()
	a = b + a + c
	print(*a)


t = int(input())
for you in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		l = [n]
		l.append(n - 3)
		l.append(n - 1)
		k = n - 5
		while k > 0:
			l.append(k)
			k -= 2
		k = n - 2
		while k > 0:
			l.insert(0, k)
			k -= 2
		for i in l:
			print(i, end=' ')
		print()


t = int(input())
for _ in range(0, t):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		start = n // 2
		while start > 2:
			print(start * 2, end=' ')
			start -= 1
		print('2 4', end='')
		start = 1
		while start <= n:
			print(' ', start, sep='', end='')
			start += 2
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	if n < 4:
		print(-1)
	else:
		for i in range(1, n + 1, 2):
			a.append(i)
		a = a[::-1] + [4, 2]
		for i in range(6, n + 1, 2):
			a.append(i)
		print(*a)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	v = []
	p = n - n % 4
	if n < 4:
		print(-1)
	else:
		for i in range(0, p, 4):
			v.extend([i + 2, i + 4, i + 1, i + 3])
		if n % 4 == 1:
			v += (n,)
		elif n % 4 == 2:
			v = v[:p - 1] + [n - 1] + [v[-1]] + [n]
		elif n % 4 == 3:
			v = v[:p - 1] + [n - 2, n] + [v[-1]] + [n - 1]
		print(*v)


PRECALC = [(1, 3, 5, 2, 4), (1, 3, 5, 2, 4, 6), (1, 3, 5, 2, 6, 4, 7), (1, 3, 5, 2, 6, 8, 4, 7), (1, 3, 5, 2, 4, 7, 9, 6, 8)]
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(2, 4, 1, 3)
		continue
	a = []
	for i in range(n // 5 - 1):
		i *= 5
		a += [i + 1, i + 3, i + 5, i + 2, i + 4]
	i = (n // 5 - 1) * 5
	a += [i + x for x in PRECALC[n % 5]]
	print(*a)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n % 2 == 0:
		a = list(range(2, n + 1, 2))
	else:
		a = list(range(1, n + 1, 2))
	a.append(n - 3)
	a.append(n - 1)
	a.extend(range(n - 5, 0, -2))
	print(*a)


import collections
for t in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		q = collections.deque()
		q.append(3)
		q.append(1)
		q.append(4)
		q.append(2)
		for i in range(5, n + 1):
			if i % 2 == 1:
				q.append(i)
			else:
				q.appendleft(i)
		print(*q)


for tc in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	out = []
	for i in range(2 * (n // 2), 4, -2):
		out.append(i)
	out.append(2)
	out.append(4)
	for i in range(1, n + 1, 2):
		out.append(i)
	print(*out)


t = int(input())
for tt in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		if n % 2 == 0:
			a = [2 * i + 1 for i in range(n // 2)]
			b = [2 * i + 2 for i in range(n // 2)]
			b.reverse()
			(a[-2], a[-1]) = (a[-1], a[-2])
			sol = a + b
		else:
			a = [2 * i + 1 for i in range(n // 2 + 1)]
			b = [2 * i + 2 for i in range(n // 2)]
			b.reverse()
			(b[0], b[1]) = (b[1], b[0])
			sol = a + b
		print(' '.join(map(str, sol)))


for t in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		l = list(range(1, n + 1))
		a = [ele for ele in l if ele % 2 == 1]
		b = [ele for ele in l if ele not in a]
		(b[0], b[1]) = (b[1], b[0])
		b.reverse()
		print(*b + a)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		x = list(range(1, n + 1, 1))
		p = []
		np = []
		y = [2, 4, 1, 3]
		for i in range(n):
			if x[i] % 2 == 0:
				p.append(x[i])
			else:
				np.append(x[i])
		del p[0:2]
		del np[0:2]
		np.sort(reverse=True)
		y.extend(p)
		y = np + y
		print(*y)


def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	ans = list(range(n, 4, -2)) + [3, 1, 4, 2] + list(range(n - 1, 4, -2))[::-1]
	print(*ans)
for _ in range(int(input())):
	solve()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		if n < 4:
			print(-1)
			return
		res = []
		i = -3
		for i in range(1, n - 6, 4):
			res += [i + 1, i + 3, i, i + 2]
		if n - i == 7:
			res += [i + 5, i + 7, i + 4, i + 6]
		elif n - i == 8:
			res += [i + 4, i + 7, i + 5, i + 8, i + 6]
		elif n - i == 9:
			res += [i + 5, i + 7, i + 4, i + 8, i + 6, i + 9]
		else:
			res += [i + 4, i + 8, i + 5, i + 9, i + 6, i + 10, i + 7]
		print(' '.join(map(str, res)))
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		even = []
		odd = []
		for i in range(1, n + 1):
			if i % 2:
				odd.append(i)
			else:
				even.append(i)
		new = list(reversed(even))[:-2] + [2, 4, 1, 3] + odd[2:]
		print(*new)


from collections import deque
t = int(input())
for tt in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		q = deque([3, 1, 4, 2])
		flg = True
		for i in range(5, n + 1):
			if flg:
				q.appendleft(i)
			else:
				q.append(i)
			flg = not flg
		for a in q:
			print(a, end=' ')
		print()


p = dict()
p['go'] = [3, -2, 3, -2, 3]
p[5] = [3, -2, 3, -2]
p[6] = [4, -3, 2, 2, -3]
p[7] = [3, 3, -4, 3, -4, 3]
p[8] = [4, 3, -4, -2, 4, -3, 4]
p[9] = [4, -3, 2, 4, -2, -3, 4, 2]
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
	elif n == 4:
		print('3 1 4 2')
	else:
		x = 1
		for _ in range(n // 5 - 1):
			for k in p['go']:
				print(x, end=' ')
				x += k
		for k in p[5 + n % 5]:
			print(x, end=' ')
			x += k
		print(x, end=' ')
		print()


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n < 4:
		print(-1)
		continue
	ans = []
	i = 2 - n % 2
	while i <= n:
		ans.append(i)
		i = i + 2
	ans.append(n - 3)
	ans.append(n - 1)
	j = n - 5
	while j >= 1:
		ans.append(j)
		j = j - 2
	print(*ans)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n == 2 or n == 3:
			print(-1)
			continue
		if n == 4:
			print('3 1 4 2')
			continue
		a = [2 * i + 1 for i in range((n + 1) // 2)]
		a.append(a[-1] - 3)
		if a[-1] + 2 == n // 2 * 2:
			a.append(a[-1] + 2)
		else:
			a.append(a[-1] + 4)
		b = [2 * i + 2 for i in range(n // 2)]
		b = b[::-1]
		for i in b:
			if i not in a:
				a.append(i)
		print(*a)
	return
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n == 4:
		print(2, 4, 1, 3)
	else:
		ans = []
		i = 1
		while i <= n:
			ans.append(i)
			i = i + 2
		i = n if n % 2 == 0 else n - 1
		while i > 0:
			ans.append(i)
			i = i - 2
		f = 0
		for i in range(n - 1):
			if abs(ans[i] - ans[i + 1]) == 1:
				if n % 2 == 0:
					if i + 3 <= n - 1:
						(ans[i + 1], ans[i + 3]) = (ans[i + 3], ans[i + 1])
						(ans[i + 2], ans[i + 3]) = (ans[i + 3], ans[i + 2])
					else:
						f = 1
				elif i + 2 <= n - 1:
					(ans[i + 1], ans[i + 2]) = (ans[i + 2], ans[i + 1])
				else:
					f = 1
				break
		if f:
			print(-1)
		else:
			print(*ans)


t = int(input(''))
while t:
	t -= 1
	n = list(range(1, int(input('')) + 1))
	if len(n) < 4:
		print(-1)
	else:
		a1 = [i for i in range(2, len(n) + 1, 2)][::-1]
		a2 = [i for i in range(1, len(n) + 1, 2)]
		(a1[len(a1) - 2], a1[len(a1) - 1]) = (a1[len(a1) - 1], a1[len(a1) - 2])
		print(' '.join(map(str, a1 + a2)))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n % 2 != 0:
		if n == 5:
			l = [1, 3, 5, 2, 4]
		else:
			l = []
			lodd = 0
			for i in range(1, n + 1, 2):
				l.append(i)
				lodd = i
			l.append(l[-1] - 3)
			l.append(l[-2] - 1)
			l.append(l[-1] - 4)
			while l[-1] != 2:
				l.append(l[-1] - 2)
		print(*l)
	else:
		if n == 4:
			l = [3, 1, 4, 2]
		elif n == 6:
			l = [1, 3, 5, 2, 6, 4]
		else:
			(l, d) = ([], {})
			for i in range(1, n, 2):
				l.append(i)
				d[i] = 0
			l.append(l[-1] - 3)
			d[l[-1]] = 0
			l.append(l[-2] + 1)
			d[l[-1]] = 0
			while l[-1] != 2:
				if l[-1] - 2 not in d.keys():
					l.append(l[-1] - 2)
				else:
					l.append(l[-1] - 4)
		print(*l)


t = int(input())
for g in range(0, t):
	n = int(input())
	if n == 2:
		print(-1)
	elif n == 3:
		print(-1)
	elif n % 2 == 0:
		even = []
		odd = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		even.append(odd[int(n / 2) - 2])
		even.append(odd[int(n / 2) - 1])
		for i in range(int(n / 2) - 3, -1, -1):
			even.append(odd[i])
		for i in range(0, n):
			print(even[i], end=' ')
		print('')
	elif n % 2 != 0:
		even = []
		odd = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		odd.append(even[int(n / 2) - 2])
		odd.append(even[int(n / 2) - 1])
		for i in range(int(n / 2) - 3, -1, -1):
			odd.append(even[i])
		for i in range(0, n):
			print(odd[i], end=' ')
		print('')


from collections import Counter, defaultdict, deque
from operator import itemgetter
import math
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	if n <= 3:
		print(-1)
		return
	arr = [0] * n
	p1 = 0
	p2 = n - 1
	par = 1
	for i in range(1, n + 1):
		if par:
			arr[p1] = i
			p1 += 1
		else:
			arr[p2] = i
			p2 -= 1
		par ^= 1
	if n & 1:
		ind = n - (n + 1) // 2 + 2
		(arr[ind], arr[ind - 1]) = (arr[ind - 1], arr[ind])
	else:
		ind = (n + 1) // 2 - 1
		(arr[ind], arr[ind - 1]) = (arr[ind - 1], arr[ind])
	print(*arr)
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
for te in range(0, t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		l = []
		countoffour = n // 4
		ans = countoffour * 4
		for i in range(0, countoffour):
			if i & 1:
				l.append(4 * i + 2)
				l.append(4 * i + 4)
				l.append(4 * i + 1)
				l.append(4 * i + 3)
			else:
				l.append(4 * i + 3)
				l.append(4 * i + 1)
				l.append(4 * i + 4)
				l.append(4 * i + 2)
		for j in range(0, 3):
			if ans < n:
				ans += 1
				summ = ans
				for i in range(0, len(l) - 1):
					if abs(l[i] - summ) >= 2 and abs(l[i + 1] - summ) >= 2:
						if abs(l[i] - summ) <= 4 and abs(l[i + 1] - summ) <= 4:
							l.insert(i + 1, summ)
		print(*l)


t = int(input())

def odd(n):
	for i in range(n, 0, -1):
		if i % 2 != 0:
			print(i, end=' ')

def even(n):
	for i in range(1, n + 1):
		if i == 2 or i == 4:
			continue
		elif i % 2 == 0:
			print(i, end=' ')
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	odd(n)
	print(4, end=' ')
	print(2, end=' ')
	even(n)
	print('')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = []
	if n == 2 or n == 3:
		print(-1)
		continue
	for j in range(1, n + 1):
		a.append(j)
	if n % 2 == 0:
		for j in range(1, n, 2):
			print(a[j], end=' ')
		print(a[j - 3], end=' ')
		k = a[j - 3]
		for j in range(n - 2, -2, -2):
			if k != a[j]:
				print(a[j], end=' ')
		print('')
	else:
		for j in range(1, n, 2):
			print(a[j], end=' ')
		print(a[j - 3], end=' ')
		k = a[j - 3]
		for j in range(n - 1, -2, -2):
			if k != a[j]:
				print(a[j], end=' ')
		print('')
		print('')


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		jg = list(range(n, 4, -2)) + [3, 1, 4, 2] + list(range(n - 1, 4, -2))[::-1]
		print(*jg)


n = int(input())

def check(x):
	t = []
	if x < 4:
		print(-1)
	else:
		for i in range(x, 0, -1):
			if i % 2 != 0:
				t.append(i)
		t.append(4)
		t.append(2)
		for i in range(6, x + 1, 2):
			t.append(i)
	print(*t)
for _ in range(n):
	m = int(input())
	check(m)


from sys import stdout, stdin
import io
import os
from collections import deque
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n >= 4:
		a = n - (n % 2 == 0)
		while a >= 1:
			stdout.write(str(a) + ' ')
			a = a - 2
		stdout.write('4 ')
		a = 2
		while a <= n - (n % 2 == 1):
			if a == 4:
				a += 2
				continue
			stdout.write(str(a) + ' ')
			a = a + 2
		stdout.write('\n')
	else:
		stdout.write('-1\n')


t = int(input())
for T in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	if n == 6:
		print('5 3 6 2 4 1')
		continue
	if n == 7:
		print('5 1 3 6 2 4 7')
		continue
	if n == 11:
		print('5 1 3 6 2 4 7 9 11 8 10')
		continue
	x = 0
	while (n - 4 * x) % 5 != 0:
		x += 1
	y = (n - 4 * x) // 5

	class ay:

		def __init__(self):
			self.n = 1

		def add4(self):
			n = self.n
			print(n + 1, n + 3, n, n + 2, end=' ')
			self.n += 4

		def add5(self):
			n = self.n
			print(n, n + 3, n + 1, n + 4, n + 2, end=' ')
			self.n += 5
	ayc = ay()
	for i in range(x):
		ayc.add4()
	for i in range(y):
		ayc.add5()
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list()
	b = list()
	for i in range(1, n + 1):
		a.append(i)
	a.remove(n - 1)
	b.append(n - 1)
	s = ''
	for i in range(n):
		if b[-1] - 3 in a:
			a.remove(b[-1] - 3)
			b.append(b[-1] - 3)
		elif b[-1] - 2 in a:
			a.remove(b[-1] - 2)
			b.append(b[-1] - 2)
		elif b[-1] - 4 in a:
			a.remove(b[-1] - 4)
			b.append(b[-1] - 4)
		elif b[-1] + 3 in a:
			a.remove(b[-1] + 3)
			b.append(b[-1] + 3)
		elif b[-1] + 2 in a:
			a.remove(b[-1] + 2)
			b.append(b[-1] + 2)
		elif b[-1] + 4 in a:
			a.remove(b[-1] + 4)
			b.append(b[-1] + 4)
	if n <= 3:
		print(-1)
	else:
		for i in b:
			s = s + str(i) + ' '
		print(s)


def main():
	t = ((1, 3, 5, 2, 4), (1, 3, 5, 2, 4, 6), (1, 3, 5, 2, 6, 4, 7), (1, 3, 5, 2, 6, 8, 4, 7), (1, 3, 5, 2, 4, 7, 9, 6, 8), (1, 3, 5, 2, 4, 6, 8, 10, 7, 9))
	for _ in range(int(input())):
		n = int(input())
		if n < 5:
			print(('-1', '2 4 1 3')[n == 4])
			continue
		(n, m) = (n // 5 - 1, n % 5)
		l = [i + j for i in range(0, n * 5, 5) for j in (1, 3, 5, 2, 4)]
		l += (n * 5 + i for i in t[m])
		print(' '.join(map(str, l)))
main()


for _ in range(int(input())):
	integer = int(input())
	result = []
	if integer % 2 == 0:
		for i in range(integer, 4, -2):
			result.append(i)
		result.append(2)
		result.append(4)
		result.append(1)
		result.append(3)
		for i in range(5, integer, 2):
			result.append(i)
	elif integer % 2 != 0:
		for i in range(integer - 1, 4, -2):
			result.append(i)
		result.append(2)
		result.append(4)
		result.append(1)
		result.append(3)
		for i in range(5, integer + 1, 2):
			result.append(i)
	if integer < 4:
		result = [-1]
	print(' '.join(map(str, result)))


def f(n):
	L = []
	if n < 4:
		return -1
	for i in range(n, 0, -1):
		if i % 2 == 1:
			L.append(i)
	L.append(4)
	L.append(2)
	for i in range(6, n + 1, 2):
		L.append(i)
	return L
n = int(input())
for i in range(n):
	j = int(input())
	if j < 4:
		print(-1)
	else:
		k = f(j)
		for i in range(j - 1):
			print(k[i], end=' ')
		print(k[j - 1])


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n < 4:
		print(-1)
	elif n % 2 == 0:
		x = n
		while x > 4:
			print(x, end=' ')
			x -= 2
		print('3 1 4 2', end=' ')
		x += 1
		while x < n:
			print(x, end=' ')
			x += 2
		print()
	else:
		x = n
		while x > 4:
			print(x, end=' ')
			x -= 2
		print('3 1 4 2', end=' ')
		x += 3
		while x < n:
			print(x, end=' ')
			x += 2
		print()


t = int(input())
out = ''
while t > 0:
	t -= 1
	n = int(input())
	if n < 4:
		out += '-1\n'
		continue
	a = []
	for i in reversed(range(1, n + 1, 2)):
		a.append(i)
	a.append(4)
	a.append(2)
	for i in range(6, n + 1, 2):
		a.append(i)
	out += ' '.join((str(i) for i in a)) + '\n'
print(out)


import sys
import math
import operator as op
from functools import reduce

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom
t = read_int()
for i in range(t):
	n = read_int()
	if n < 4:
		print(-1)
	else:
		ans = []
		if n & 1 != 0:
			for i in range(1, n + 1):
				if i & 1 != 0:
					ans.append(i)
			ans.append(n - 3)
			ans.append(n - 1)
			for i in range(n - 5, 0, -1):
				if i & 1 == 0:
					ans.append(i)
			print(*ans)
		else:
			for i in range(1, n + 1):
				if i & 1 == 0:
					ans.append(i)
			ans.append(n - 3)
			ans.append(n - 1)
			for i in range(n - 5, 0, -1):
				if i & 1 != 0:
					ans.append(i)
			print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		evens = [2 * x for x in range(1, n // 2 + 1)]
		odds = [x - 1 for x in evens]
		if n % 2 == 1:
			odds.append(n)
			(evens[-1], evens[-2]) = (evens[-2], evens[-1])
		else:
			(odds[-1], odds[-2]) = (odds[-2], odds[-1])
		evens.reverse()
		for i in odds:
			print(i, end=' ')
		for i in evens:
			print(i, end=' ')
		print('')


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		if N <= 3:
			print(-1)
		elif N == 4:
			print('3 1 4 2')
		else:
			for i in range(1, N + 1, 2):
				print(i, end=' ')
			if N <= 6:
				for i in range(2, N + 1, 2):
					print(i, end=' ')
			elif N % 2 != 0:
				print(N - 3, N - 1, end=' ')
				for i in range(N - 5, 1, -2):
					print(i, end=' ')
			else:
				print(N - 4, N, N - 2, end=' ')
				for i in range(N - 6, 1, -2):
					print(i, end=' ')
			print()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	l = []
	start = n if n % 2 == 1 else n - 1
	for i in range(start, 0, -2):
		l.append(i)
	l.append(4)
	l.append(2)
	for i in range(6, n + 1, 2):
		l.append(i)
	print(*l)


for t in range(int(input())):
	n = int(input())
	if n < 4:
		print('-1')
		continue
	pattern = [1, 3, 5, 2, 4]
	ans = [pattern[i % 5] + 5 * (i // 5) for i in range(n // 5 * 5)]
	if n % 5 == 1:
		ans.append(n)
	elif n % 5 == 2:
		ans[-3] = n - 1
		ans += [n, n - 2]
	elif n % 5 == 3:
		ans[-3] = n - 2
		ans += [n, n - 3, n - 1]
	elif n % 5 == 4:
		ans += [n - 1, n - 3, n, n - 2]
	print(*ans)


t = int(input())
for aoaoao in range(t):
	n = int(input())
	if n == 1:
		print(1)
	elif n < 5:
		if n == 4:
			print('3 1 4 2')
		else:
			print(-1)
	else:
		a = [[], [], [], [], []]
		a[0] = [1, 3, 5, 2, 4]
		a[1] = [1, 3, 5, 2, 6, 4]
		a[2] = [1, 3, 5, 7, 4, 2, 6]
		a[3] = [1, 3, 5, 8, 6, 2, 4, 7]
		a[4] = [1, 3, 5, 9, 7, 4, 2, 6, 8]
		f = -1
		for x in a[n % 5]:
			print(x, end=' ')
		f = max(a[n % 5])
		while f < n:
			for x in a[0]:
				print(f + x, end=' ')
			f += 5
		print()


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
cases = int(input())
for t in range(cases):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		a = list(range(1, n + 1, 2)) + list(range(2, n + 1, 2))[::-1]
		mid = n // 2
		if n % 2 != 0:
			p = mid + 1
			(a[p], a[p + 1]) = (a[p + 1], a[p])
		else:
			p = mid - 1
			(a[p], a[p - 1]) = (a[p - 1], a[p])
		print(*a)


def main():
	n = int(input())
	if n in [2, 3]:
		print(-1)
		return
	res = []
	i = 2
	if n % 4:
		res.append(1)
		i += 1
	for _ in range(n // 4):
		res.append(i)
		res.append(i + 2)
		res.append(i - 1)
		res.append(i + 1)
		i += 4
	if n % 4 == 2:
		res.append(i - 1)
	if n % 4 == 3:
		res = res[:-4]
		i -= 3
		res.append(i)
		res.append(i + 3)
		res.append(i + 1)
		res.append(i - 2)
		res.append(i + 2)
		res.append(i - 1)
	print(' '.join(map(str, res)))
for _ in range(int(input())):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		(o, e) = ([], [])
		for i in range(1, n + 1):
			if i & 1:
				o.append(i)
			else:
				e.append(i)
		o.sort(reverse=True)
		o.append(4)
		o.append(2)
		e.remove(4)
		e.remove(2)
		o.extend(e)
		for i in range(len(o) - 1):
			print(o[i], end=' ')
		print(o[-1])


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def pred(n, k, pointer):
	return pointer - k >= n
odd = [1, 3, 5]
even = [4, 2, 6]
for i in range(7, 1001):
	if i % 2:
		odd.append(i)
	else:
		even.append(i)
for _ in range(inin()):
	n = inin()
	if n < 4:
		print(-1)
	else:
		arr = odd[0:(n + 1) // 2]
		arr.reverse()
		arr += even[0:n // 2]
		print(*arr)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n % 2 == 1:
		evens = [i * 2 for i in range(1, n // 2 + 1)]
		odds = [i * 2 - 1 for i in range(1, math.ceil(n / 2) + 1)]
	else:
		evens = [i * 2 for i in range(1, n // 2 + 1)]
		odds = [i * 2 - 1 for i in range(1, n // 2 + 1)]
	ans = []
	odds.sort(reverse=True)
	for x in odds:
		ans.append(x)
	(evens[0], evens[1]) = (evens[1], evens[0])
	for x in evens:
		ans.append(x)
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		c = 1
		if n % 2 == 0:
			for i in range(1, n, 2):
				print(i, end=' ')
			if n - 4 > 0:
				print(n - 4, end=' ')
			for i in range(n, 0, -2):
				if i != n - 4 and i != 0:
					print(i, end=' ')
		else:
			for i in range(1, n + 1, 2):
				print(i, end=' ')
			if n - 3 > 0:
				print(n - 3, end=' ')
			for i in range(n - 1, 0, -2):
				if i != n - 3 and i != 0:
					print(i, end=' ')
		print()


for _ in ' ' * int(input()):
	a = int(input())
	if a < 4:
		print(-1)
	elif a == 4:
		print('3 1 4 2')
	else:
		if a & 1 == 0:
			for i in range(1, a + 1, 2):
				print(i, end=' ')
			print(a - 4, end=' ')
			for i in range(a, 0, -2):
				if i != a - 4:
					print(i, end=' ')
		else:
			for i in range(2, a + 1, 2):
				print(i, end=' ')
			print(a - 4, end=' ')
			for i in range(a, 0, -2):
				if i != a - 4:
					print(i, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n % 2:
		out = [i for i in range(n, 0, -2)]
	else:
		out = [i for i in range(n - 1, 0, -2)]
	out += [4, 2] + [i for i in range(6, n + 1, 2)]
	print(*out)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	p = []
	for i in range(6, n + 1, 2):
		p.insert(0, i)
	p.append(2)
	p.append(4)
	for i in range(1, n + 1, 2):
		p.append(i)
	print(*p)


from collections import deque
t = int(input())
mod = {0: [2, 4, 1, 3], 1: [1, 4, 2, 5, 3], 2: [1, 4, 2, 5, 3, 6], 3: [1, 4, 2, 5, 7, 3, 6]}
for _ in range(t):
	n = int(input())
	ans = []
	if n < 4:
		print('-1')
		continue
	i = 0
	n -= 4
	while n >= 4:
		ans += [m + i for m in mod[0]]
		i += 4
		n -= 4
	ans += [m + i for m in mod[n]]
	print(' '.join(list(map(str, ans))))


import sys, bisect, string, math, time, functools, random
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(1, 0), (-1, 0), (0, 1), (0, -1)]
EightNb = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('EWNS', FourNb))
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, init=True):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			self.stdin(inp_size)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.size = int(input())
		else:
			self.size = inp_size
		(self.edges, _) = GI(self.size, self.size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.size = len(ls) + 1
		(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def __str__(self):
		return str(self.edges)

	def dfs(self, x, func=lambda prv, nx, dist: prv + dist, root_v=0):
		q = deque()
		q.append(x)
		v = [-1] * self.size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == -1:
					q.append(nb)
					v[nb] = func(v[c], nb, d)
		return v

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.size
		self.ETout = [-1] * self.size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		r = min(self.size, r)
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][r - (1 << N)])

	def query_id(self, l, r):
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][r - (1 << N)])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][r - (1 << N)]):
			b = a
		return b

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)
show_flg = False
show_flg = True
ans = 0
b = ['3142', '52413', '142635', '7426315']
T = I()
for _ in range(T):
	n = I()
	if n < 4:
		a = [-1]
	else:
		r = n % 4
		a = list(b[r])
		for i in range((n - r) // 4 - 1):
			x = i * 4 + r + 4 + 1
			a += [x + 1, x + 3, x, x + 2]
	print(*a)


for i in range(int(input())):
	s = int(input())
	print(*[[*range(s - s % 2, 4, -2), 2, 4, *range(1, s + 1, 2)], [-1]][s < 4])


import collections
ans = [[0] for i in range(10)]
ans[4] = [3, 1, 4, 2]
ans[5] = [4, 1, 3, 5, 2]
ans[6] = [5, 2, 4, 1, 3, 6]
for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n <= 6:
		for x in ans[n]:
			print(x, end=' ')
	else:
		dq = collections.deque(ans[6])
		for i in range(7, n + 1):
			if i % 2:
				dq.appendleft(i)
			else:
				dq.append(i)
		for x in dq:
			print(x, end=' ')
	print()


def gen_arr(n, start):
	ans = list()
	while True:
		ans.append(start)
		if start == n:
			break
		start += 2
	start += 1
	while True:
		start -= 4
		if start > 0:
			ans.append(start)
		start += 2
		if start > 0:
			ans.append(start)
		else:
			break
		start -= 4
		if start > 0:
			ans.append(start)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		if n % 2 == 0:
			ans = gen_arr(n, 2)
		else:
			ans = gen_arr(n, 1)
		for x in ans:
			print(x, end=' ')
		print()


t = int(input())
for j in range(t):
	n = int(input())
	l = []
	if n < 4:
		print(-1)
	elif n % 2 != 0:
		for i in range(n, 0, -2):
			l.append(i)
		for i in range(2, n + 1, 2):
			l.append(i)
		(l[n // 2 + 2], l[n // 2 + 1]) = (l[n // 2 + 1], l[n // 2 + 2])
		print(*l)
	else:
		for i in range(n - 1, 0, -2):
			l.append(i)
		for i in range(2, n + 1, 2):
			l.append(i)
		(l[n // 2 + 1], l[n // 2]) = (l[n // 2], l[n // 2 + 1])
		print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		(o, e) = (n // 2 + n % 2, n // 2)
		Odds = [0 for _ in range(o)]
		Evens = [0 for _ in range(e)]
		for i in range(o):
			if i % 2 == 0:
				Odds[o - 1 - i // 2] = 2 * i + 1
			else:
				Odds[i // 2] = 2 * i + 1
		for i in range(e):
			if i % 2 == 0:
				Evens[e - 1 - i // 2] = 2 * i + 2
			else:
				Evens[i // 2] = 2 * i + 2
		for i in range(o):
			print(Odds[i], end=' ')
		for i in range(e):
			print(Evens[i], end=' ' * (i != e - 1))
		print()


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	n = ni()
	if n < 4:
		print(-1)
		return
	l = [i for i in range(1, n + 1, 2)]
	g = [i for i in range(2, n + 1, 2)][::-1]
	if n % 2:
		(g[0], g[1]) = (g[1], g[0])
	else:
		(l[-1], l[-2]) = (l[-2], l[-1])
	l += g
	print(*l)
	return
T = ni()
for _ in range(T):
	solve()


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	n = int(input())
	if n <= 3:
		print(-1)
		return
	elif n == 4:
		print(*[3, 1, 4, 2])
	elif n == 5:
		print(*[5, 3, 1, 4, 2])
	elif n % 2 == 0:
		arr = [i for i in range(1, n, 2)]
		even = arr[-1] - 3
		arr.append(even)
		arr.append(arr[-1] + 4)
		arr += [i for i in range(n - 2, 1, -2) if i != even]
		print(*arr)
	else:
		arr = [i for i in range(1, n + 1, 2)]
		arr.append(arr[-1] - 3)
		arr.append(arr[-1] + 2)
		arr.append(arr[-1] - 4)
		arr += [j for j in range(arr[-1] - 2, 1, -2)]
		print(*arr)
main()


from sys import stdin
from collections import deque
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n <= 3:
		print(-1)
	else:
		d = deque(['2', '4', '1', '3'])
		for i in range(5, n + 1):
			if i % 2 == 0:
				d.appendleft(str(i))
			else:
				d.append(str(i))
		print(' '.join(d))


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	if n == 4:
		print('3 1 4 2')
	else:
		print(*list(range(6, n + 1, 2))[::-1], end=' ')
		print('3 1 4 2', end=' ')
		print(*list(range(5, n + 1, 2)))


ls = [4, 2]
tmp = 0
for _ in range(int(input())):
	ans = []
	rem = []
	n = int(input())
	d = dict()
	if n & 1:
		tmp = n
	else:
		tmp = n - 1
	for i in range(tmp, 0, -2):
		ans.append(i)
		d[i] = 1
	ans.append(4)
	d[4] = 1
	ans.append(2)
	d[2] = 1
	for i in range(1, n + 1):
		if i not in d:
			rem.append(i)
	for i in rem:
		ans.append(i)
	if n == 2 or n == 3:
		print(-1)
	else:
		for i in ans:
			print(i, end=' ')


N = int(input())
for i in range(N):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	else:
		odd = [i for i in range(1, n + 1, 2)]
		even = [i for i in range(2, n + 1, 2)]
	lengthofeven = len(even)
	(even[0], even[1]) = (even[1], even[0])
	for k in range(len(odd) - 1, -1, -1):
		print(odd[k], end=' ')
	for k in range(lengthofeven):
		if k == lengthofeven - 1:
			print(even[k])
		else:
			print(even[k], end=' ')


import io
import os
from collections import Counter, defaultdict, deque

def solve(N):
	if N <= 3:
		return -1
	arr = deque()
	for i in range(1, N + 1):
		if i == 2:
			i = 4
		elif i == 4:
			i = 2
		if i % 2 == 0:
			arr.append(i)
		else:
			arr.appendleft(i)
	return ' '.join(map(str, arr))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


T = int(input())
while T:
	n = int(input())
	if n < 4:
		print(-1)
	else:
		ans = []
		last = 0
		for i in range(n, -1, -1):
			if i % 2 != 0:
				ans.append(i)
				last = i
		ans.append(4)
		ans.append(2)
		for i in range(6, n + 1):
			if i % 2 == 0:
				ans.append(i)
		for i in ans:
			print(i, end=' ')
	T -= 1


def f(n):
	if n < 4:
		print(-1)
		return
	a = list(range(n - 1, 0, -2))
	(a[0], a[1]) = (a[1], a[0])
	a = list(range((not n & 1) + 1, n + 1, 2)) + a
	print(*a)
t = int(input())
for _ in range(t):
	f(int(input()))


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = ''
	if n < 4:
		print('-1')
		continue
	even = '4 2 '
	for i in range(n, -1, -1):
		if i % 2 == 1:
			s += str(i) + ' '
	for i in range(6, n + 1):
		if i % 2 == 0:
			even += str(i) + ' '
	print(s + even)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
d = defaultdict(int)
for i in range(t):
	n = I()
	if n < 4:
		print(-1)
	elif n == 4:
		print(*[3, 1, 4, 2])
	else:
		l = []
		for i in range(1, n + 1, 2):
			l.append(i)
		x = l[-1] - 3
		l.append(x)
		if n % 2 == 0:
			r = n
		else:
			r = n - 1
		for i in range(r, 0, -2):
			if i == x:
				continue
			else:
				l.append(i)
		print(*l)


PATTERN = {0: [1, 4, 2, 5, 3], 1: [1, 4, 2, 6, 3, 5], 2: [1, 4, 2, 6, 3, 7, 5], 3: [1, 5, 2, 6, 3, 7, 4, 8], 4: [1, 4, 2, 5, 3, 7, 9, 6, 8]}

def solve(n):
	if n < 4:
		ans = -1
	elif n == 4:
		ans = [2, 4, 1, 3]
	else:
		ans = []
		common = n // 5 - 1
		mod = n % 5
		for jj in range(common):
			ans += [jj * 5 + k for k in PATTERN[0]]
		ans += [common * 5 + k for k in PATTERN[mod]]
	return ans

def output(arr):
	if isinstance(arr, list):
		print(' '.join((str(k) for k in arr)))
	else:
		print(arr)
t = int(input())
for ___ in range(t):
	n = int(input())
	ans = solve(n)
	output(ans)


visited = []

def isValidPair(i, j):
	return not (abs(i - j) > 4 or abs(i - j) < 2)

def isValidPerm(arr):
	if len(arr) != len(visited):
		return False
	for i in range(1, len(arr)):
		if not isValidPair(arr[i - 1], arr[i]):
			return False
	return True

def findPerm(cur, cura):
	if visited[cur - 1] != -1:
		return []
	visited[cur - 1] = 1
	cura.append(cur)
	if isValidPerm(cura):
		return cura
	if len(cura) >= len(visited):
		return []
	for i in range(cur - 4, cur + 5):
		if i > 0 and i <= len(visited) and isValidPair(i, cur):
			newa = findPerm(i, cura)
			if len(newa) == len(visited):
				return newa
	return []
t = int(input())
while t > 0:
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		visited = [-1] * n
		arr = findPerm(i, [])
		if len(arr) == n:
			break
	if len(arr) == n:
		print(' '.join([str(x) for x in arr]))
	else:
		print(-1)
	t -= 1


t = int(input())
j = 0
while j < t:
	n = int(input())
	l = []
	r = []
	for i in range(0, n):
		if i % 2 == 0:
			r.append(n - i)
		else:
			l.append(n - i)
	if r[0] - l[len(l) - 1] < 2:
		print(-1)
	elif r[0] - l[len(l) - 1] > 4:
		if n % 2 == 0:
			l.append(r[len(r) - 2])
			r.remove(r[len(r) - 2])
		else:
			l.append(r[len(r) - 3])
			r.remove(r[len(r) - 3])
		r.sort()
		l = l + r
		print(*l)
	else:
		l = l + r
		print(*l)
	j += 1


def solve(n):
	if n < 4:
		print(-1)
		return
	ans = []
	l = n
	if n % 2 == 0:
		l = n - 1
	while l > 0:
		ans.append(l)
		l -= 2
	ans.extend([4, 2])
	l = 6
	while l <= n:
		ans.append(l)
		l += 2
	print(*ans, sep=' ')
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


for i in range(int(input())):
	a = int(input())
	if a < 4:
		print(-1)
		continue
	elif a == 4:
		print(3, 1, 4, 2)
		continue
	elif a == 5:
		print(3, 1, 4, 2, 5)
		continue
	if a % 2 == 0:
		for j in range(1, a):
			if j % 2 != 0:
				print(j, end=' ')
		print(a - 4, a, a - 2, end=' ')
		for j in range(a - 6, 0, -2):
			print(j, end=' ')
		print()
	else:
		for j in range(1, a + 1):
			if j % 2 != 0:
				print(j, end=' ')
		print(a - 3, a - 1, a - 5, end=' ')
		for j in range(a - 7, 0, -2):
			print(j, end=' ')
		print()


def get_series(n):
	if n < 4:
		return -1
	if n == 4:
		return [3, 1, 4, 2]
	if n == 5:
		return [1, 4, 2, 5, 3]
	if n == 6:
		return [1, 4, 6, 2, 5, 3]
	if n == 7:
		return [1, 4, 2, 5, 7, 3, 6]
	if n == 8:
		return [1, 4, 2, 5, 8, 6, 3, 7]
	series = get_series(n - 5)
	series += list(map(lambda x: x + n - 5, get_series(5)))
	return series
for _ in range(int(input())):
	ans = get_series(int(input()))
	if ans == -1:
		print(ans)
	else:
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ls = []
	if n < 4:
		print(-1)
	else:
		if n % 2 == 0:
			for i in range(n, 0, -1):
				if i % 2 == 1:
					ls.append(i)
			ls.append(4)
			for i in range(1, n + 1):
				if i % 2 != 1 and i != 4:
					ls.append(i)
		else:
			for i in range(n, 0, -1):
				if i % 2 == 1:
					ls.append(i)
			ls.append(4)
			for i in range(1, n + 1):
				if i % 2 != 1 and i != 4:
					ls.append(i)
		for i in ls:
			print(i, end=' ')


T = int(input())
for t in range(T):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print('2 4 1 3')
		continue
	if n == 5:
		print('1 3 5 2 4')
		continue
	if n == 6:
		print('1 3 5 2 4 6')
		continue
	for i in range(n)[::2]:
		print(i + 1)
	start = None
	if n % 2 == 1:
		print(n - 3)
		print(n - 1)
		start = n - 6
	else:
		print(n - 4)
		print(n)
		print(n - 2)
		start = n - 7
	for i in range(n)[start:0:-2]:
		print(i + 1)


def swapPositions(list, pos1, pos2):
	(list[pos1], list[pos2]) = (list[pos2], list[pos1])
	return list
for t in range(int(input())):
	n = int(input())
	e = []
	o = []
	a = []
	if n <= 3:
		print(-1)
	else:
		j = 0
		for i in range(2, n + 1, 2):
			a.append(i)
			o.append(i - 1)
			j += 1
		if n % 2 != 0:
			o.append(n)
		o.reverse()
		swapPositions(o, 0, 1)
		a.extend(o)
		if abs(a[j - 1] - a[j]) < 2:
			swapPositions(a, j + 2, j + 1)
			swapPositions(a, j + 1, j)
			swapPositions(a, j + 2, j + 1)
		print(*a, sep=' ')


for t in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		answer = []
		if n % 2 == 0:
			odd = list(range(1, n + 1, 2))
			(odd[-1], odd[-2]) = (odd[-2], odd[-1])
			answer += odd
			answer += list(range(n, 0, -2))
		else:
			even = list(range(2, n + 1, 2))
			(even[-1], even[-2]) = (even[-2], even[-1])
			answer += even
			answer += list(range(n, 0, -2))
		print(*answer)


def perm(n):
	for i in range(n, 0, -1):
		if i % 2 != 0:
			print(i, end=' ')
	print(4, 2, end=' ')
	for i in range(2, n + 1):
		if i % 2 == 0 and i != 2 and (i != 4):
			print(i, end=' ')
	print()
t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		perm(n)


seq = [1, 3, 5, 2, 4, 6, 8, 10, 7, 9]
after = [[1], [1, 'l', 2], [1, 3, 'l', 2], [1, 3, 'l', 2, 4], [1, 3, 5, 2, 4], [1, 3, 5, 2, 4, 6], [1, 5, 2, 6, 3, 7, 4], [1, 5, 2, 6, 3, 7, 4, 8], [1, 3, 5, 2, 4, 7, 9, 6, 8]]
base = [[-1], [-1], [-1], [2, 4, 1, 3], [1, 3, 5, 2, 4], [1, 3, 5, 2, 4, 6], [1, 5, 2, 6, 3, 7, 4], [1, 5, 2, 6, 3, 7, 4, 8], [1, 3, 5, 2, 4, 7, 9, 6, 8]]

def check(ans):
	for i in range(1, len(ans)):
		if not 2 <= abs(ans[i - 1] - ans[i]) <= 4:
			print('EXCEPT', len(ans), ans)
			exit(0)
for _ in range(int(input())):
	n = int(input())
	ans = []
	left = n % 10
	start = 10 * (n // 10)
	if start == 0:
		print(*base[n - 1])
		continue
	for i in range(n - left):
		ans.append(seq[i % 10] + 10 * (i // 10))
	if left == 0:
		print(*ans)
		continue
	toadd = [start + x if x != 'l' else ans.pop() for x in after[left - 1]]
	ans.extend(toadd)
	print(*ans)


for _ in range(int(input())):
	a = int(input())
	if a < 4:
		print(-1)
		continue
	b = a if a % 2 == 1 else a - 1
	for i in range(b, 0, -2):
		print(i, end=' ')
	print(4, 2, end=' ')
	for i in range(6, a + 1, 2):
		print(i, end=' ')
	print()


T = int(input())
for _ in range(T):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		left = []
		for i in range(1, n + 1, 2):
			left.append(i)
		right = []
		right.append(4)
		right.append(2)
		for i in range(6, n + 1, 2):
			right.append(i)
		right.reverse()
		for i in left:
			right.append(i)
		for i in right:
			print(i, end=' ')
		print('')


for i in range(int(input())):
	N = int(input())
	odd = []
	if N == 2 or N == 3:
		print(-1)
		continue
	even = []
	for i in range(1, N + 1, 2):
		odd.append(i)
	for i in range(2, N + 1, 2):
		even.append(i)
	even.reverse()
	if even[0] < odd[-1]:
		(even[0], even[1]) = (even[1], even[0])
	else:
		(odd[-1], odd[-2]) = (odd[-2], odd[-1])
	lis3 = odd + even
	for i in lis3:
		print(i, end=' ')
	print()


from sys import stdin

def a4(p):
	print(p + 1, p + 3, p, p + 2, end=' ')

def a5(p):
	print(p, p + 3, p + 1, p + 4, p + 2, end=' ')

def a6(p):
	print(p, p + 3, p + 1, p + 4, p + 2, p + 5, end=' ')

def a7(p):
	print(p, p + 3, p + 1, p + 5, p + 2, p + 4, p + 6, end=' ')

def solve(n):
	i = 1
	while n >= 8:
		a4(i)
		i += 4
		n -= 4
	if n == 4:
		a4(i)
	elif n == 5:
		a5(i)
	elif n == 6:
		a6(i)
	elif n == 7:
		a7(i)
	print()

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		if n <= 3:
			print(-1)
		else:
			solve(n)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	if n < 4:
		print(-1)
		continue
	elif n == 4:
		a += [2, 4, 1, 3]
	elif n % 2 == 0 and n > 4:
		for i in range(n, 1, -2):
			if i != 4:
				a.append(i)
		a = a + [5, 3, 1, 4]
		if n >= 7:
			for i in range(7, n, 2):
				a.append(i)
	else:
		for i in range(n - 1, 1, -2):
			if i != 4:
				a.append(i)
		a = a + [5, 3, 1, 4]
		if n >= 7:
			for i in range(7, n + 2, 2):
				a.append(i)
	a = list(map(str, a))
	print(' '.join(a))


t = int(input())
for __ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		ps = [[2, 4, 1, 3], [3, 1, 4, 2, 5], [1, 4, 2, 5, 3, 6], [5, 1, 3, 6, 2, 4, 7]]
		ret = ps[n % 4]
		for i in range(n % 4 + 4, n, 4):
			ret.extend([i + 2, i + 4, i + 1, i + 3])
		print(' '.join(map(str, ret)))


t = int(input())
for i in range(t):
	n = int(input())
	d = []
	if n <= 3:
		print(-1)
	else:
		s = [i for i in range(1, n + 1)]
		a = s[0::2]
		b = s[1::2]
		if n % 2 != 0:
			r = b.pop(-2)
			b.append(r)
		else:
			r = a.pop(-2)
			a.append(r)
		b.reverse()
		d.append(a)
		d.append(b)
		print(*d[0], *d[1])


for _ in range(int(input())):
	n = int(input())
	even = []
	odd = []
	for i in range(1, n + 1):
		if i % 2:
			even.append(i)
		else:
			odd.append(i)
	if n <= 3:
		print(-1)
		continue
	if len(even) <= len(odd):
		(even[-1], even[-2]) = (even[-2], even[-1])
	else:
		(odd[-1], odd[-2]) = (odd[-2], odd[-1])
	res = even + odd[::-1]
	print(*res)


def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	a = list(range(1, n + 1))
	res = a[::2][::-1] + [4, 2] + a[5::2]
	print(*res)
for _ in range(int(input())):
	solve()


for f in range(int(input())):
	n = int(input())
	if n < 5:
		if n < 4:
			print(-1)
		else:
			print(2, 4, 1, 3)
	else:
		i = 0
		per = 1
		sol = [0] * n
		while per <= n:
			sol[i] = per
			per += 2
			i += 1
		if n % 2 == 0:
			per -= 5
			sol[i] = per
			i += 1
			per += 4
			sol[i] = per
			i += 1
			per -= 2
			sol[i] = per
			i += 1
			per -= 4
		else:
			per -= 5
			sol[i] = per
			i += 1
			per += 2
			sol[i] = per
			i += 1
			per -= 4
		while per > 0:
			sol[i] = per
			per -= 2
			i += 1
		print(*sol)


t = int(input())
for i in range(t):
	n = int(input())
	p = n
	x = 0
	if n % 4 != 0:
		x = n % 4
		n = n - x
	(l, l1) = ([], [])
	f = 0
	s = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			l.append(i)
			f += 1
		else:
			l1.append(i)
		if f == 2:
			s.extend(l)
			s.extend(l1)
			l = []
			l1 = []
			f = 0
	if p <= 3:
		print(-1)
	elif x == 1:
		s.append(n + x)
		print(*s)
	elif x == 2:
		s.insert(n - 1, n + 1)
		s.append(n + x)
		print(*s)
	elif x == 3:
		s.insert(n - 3, n + 2)
		s.append(n + 1)
		s.append(n + x)
		print(*s)
	else:
		print(*s)


def solve(n):
	if n <= 3:
		return ['-1']
	(even, odd) = ([], [])
	for i in range(1, n + 1):
		if i % 2:
			odd.append(i)
		else:
			even.append(i)
	odd[:] = odd[::-1]
	(even[0], even[1]) = (even[1], even[0])
	ans = odd + even
	return list(map(str, ans))
t = int(input())
for i in range(t):
	n = int(input())
	ans = solve(n)
	print(' '.join(ans))


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	c = 0
	if c:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		n = ii()
		n1 = n
		if n <= 5:
			if n <= 3:
				print('-1')
			if n == 4:
				print(3, 1, 4, 2)
			if n == 5:
				print(1, 3, 5, 2, 4)
			continue
		if n % 2 == 0:
			n1 = n
			x = [n1 - 4, n1, n1 - 2]
			for i in range(1, n + 1, 2):
				print(i, end=' ')
			for i in range(n1 - 6, 1, -2):
				x.append(i)
			print(*x)
		else:
			n1 = n - 1
			for i in range(1, n + 1, 2):
				print(i, end=' ')
			x = [n1 - 2, n1]
			for i in range(n1 - 4, 1, -2):
				x.append(i)
			print(*x)
solve()


from sys import stdin, stdout
for test in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n == 2 or n == 3:
		print('-1')
	else:
		ans = [3, 1, 4, 2]
		for i in range(5, n + 1):
			if i % 2 == 1:
				ans.append(i)
			else:
				ans = [i] + ans
		print(*ans, sep=' ')


t = int(input())

def solve(n):
	if n <= 3:
		return []
	if n == 4:
		return [2, 4, 1, 3]
	l1 = []
	l2 = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			l1.append(i)
		else:
			l2.append(i)
	if n % 2 == 0:
		temp1 = l1[-1]
		temp2 = l1[-2]
		l1[-1] = l1[-3]
		l1[-2] = temp1
		l1[-3] = temp2
	else:
		temp = l1[-1]
		l1[-1] = l1[-2]
		l1[-2] = temp
	l1.extend(reversed(l2))
	return l1
for i in range(0, t):
	n = int(input())
	res = solve(n)
	if len(res) == 0:
		print(-1)
	else:
		print(' '.join(map(str, res)))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		res = [0] * n
		if n % 2 == 0:
			for i in range(n // 2):
				res[i] = n - 2 * i - 1
			for i in range(n // 2, n):
				res[i] = 2 * (i - n // 2 + 1)
			(res[n // 2], res[n // 2 + 1]) = (res[n // 2 + 1], res[n // 2])
		else:
			for i in range(n // 2 + 1):
				res[i] = n - 2 * i
			for i in range(n // 2 + 1, n):
				res[i] = 2 * (i - n // 2)
			(res[n // 2 + 1], res[n // 2 + 2]) = (res[n // 2 + 2], res[n // 2 + 1])
		print(*res, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		arr = [3, 1, 4, 2]
		if n > 4:
			x = 5
			while x != n + 1:
				if x % 2 == 0:
					arr.append(x)
				else:
					arr.insert(0, x)
				x += 1
		print(*arr)


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	s = ''
	n = int(input())
	if n < 4:
		print(-1)
	else:
		print(*[i for i in range(n - (n % 2 ^ 1), 3, -2)] + [3, 1, 4, 2] + [i for i in range(6, n + 1, 2)])


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n <= 3:
			print(-1)
		elif n == 4:
			ans = [3, 1, 4, 2]
			print(*ans)
		elif n == 5:
			ans = [2, 4, 1, 3, 5]
			print(*ans)
		else:
			if n % 2 == 0:
				even = n
				odd = n - 1
			else:
				even = n - 1
				odd = n
			L = []
			while even > 6:
				L.append(even)
				even -= 2
			R = []
			while odd > 5:
				R.append(odd)
				odd -= 2
			R.reverse()
			ans = L + [6, 2, 4, 1, 3, 5] + R
			print(*ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1', end=' ')
	elif n == 4:
		print('3 1 4 2', end=' ')
	elif n % 2:
		for i in range(1, n + 1, 2):
			print(i, end=' ')
		print(n - 3, end=' ')
		print(n - 1, end=' ')
		if n > 6:
			for j in range(n - 5, 1, -2):
				print(j, end=' ')
	else:
		for i in range(1, n, 2):
			print(i, end=' ')
		print(n - 4, end=' ')
		print(n, end=' ')
		print(n - 2, end=' ')
		if n > 7:
			for j in range(n - 6, 1, -2):
				print(j, end=' ')


def s_perm(n: int):
	if n < 4:
		return -1
	even_list = []
	for i in range(2, n + 1, 2):
		even_list.append(i)
	odd_list = []
	for i in range(1, n + 1, 2):
		odd_list.append(i)
	odd_list.reverse()
	if n // 2 * 2 == n:
		(odd_list[0], odd_list[1]) = (odd_list[1], odd_list[0])
	else:
		(even_list[len(even_list) - 1], even_list[len(even_list) - 2]) = (even_list[len(even_list) - 2], even_list[len(even_list) - 1])
	return ' '.join(map(str, even_list + odd_list))
import os
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	ans = s_perm(n)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	b = []
	if n < 4:
		print('-1')
	else:
		for i in range(1, n + 1):
			if i % 2 == 0:
				b.append(i)
			else:
				a.append(i)
		p = b.remove(2)
		q = b.remove(4)
		print(*a[::-1], 4, 2, *b)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		perm = []
		if n % 2 == 0:
			for i in range(n - 1, 0, -2):
				perm.append(i)
			perm.append(4)
			perm.append(2)
			for i in range(6, n + 1, 2):
				perm.append(i)
		else:
			for i in range(n, 0, -2):
				perm.append(i)
			perm.append(4)
			perm.append(2)
			for i in range(6, n, 2):
				perm.append(i)
		print(' '.join(map(str, perm)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(2, 4, 1, 3)
		continue
	a = []
	if n % 2:
		for i in range(1, n // 2 + 2):
			a.append(i * 2 - 1)
		a.append(n - 3)
		a.append(n - 1)
		for i in range(n - 5, 0, -2):
			a.append(i)
	else:
		for i in range(1, n // 2 + 1):
			a.append(i * 2 - 1)
		a.append(n - 4)
		a.append(n)
		a.append(n - 2)
		for i in range(n - 6, 0, -2):
			a.append(i)
	print(*a)


t = int(input())
for asdka in range(t):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		lis = []
		if n % 4 == 0:
			k = n // 4
			add = 0
			for i in range(k):
				lis.append(2 + add)
				lis.append(4 + add)
				lis.append(1 + add)
				lis.append(3 + add)
				add += 4
			print(*lis)
		elif n % 4 == 1:
			k = n // 4
			add = 0
			for i in range(k):
				lis.append(2 + add)
				lis.append(4 + add)
				lis.append(1 + add)
				lis.append(3 + add)
				add += 4
			lis.append(1 + add)
			print(*lis)
		elif n % 4 == 2:
			k = n // 4
			add = 0
			for i in range(k - 1):
				lis.append(2 + add)
				lis.append(4 + add)
				lis.append(1 + add)
				lis.append(3 + add)
				add += 4
			lis.append(2 + add)
			lis.append(6 + add)
			lis.append(4 + add)
			lis.append(1 + add)
			lis.append(3 + add)
			lis.append(5 + add)
			print(*lis)
		elif n % 4 == 3:
			k = n // 4
			add = 0
			for i in range(k - 1):
				lis.append(2 + add)
				lis.append(4 + add)
				lis.append(1 + add)
				lis.append(3 + add)
				add += 4
			lis.append(2 + add)
			lis.append(6 + add)
			lis.append(4 + add)
			lis.append(1 + add)
			lis.append(3 + add)
			lis.append(5 + add)
			lis.append(7 + add)
			print(*lis)


t = int(input())
for _ in range(0, t):
	n = int(input())
	if n > 3:
		ans = []
		ss = 0
		ss += n
		if not ss % 2:
			ss -= 1
		for i in range(ss, -1, -2):
			ans.append(i)
		ans.append(4)
		ans.append(2)
		for i in range(6, n + 1, 2):
			ans.append(i)
		print(*ans)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		i = [x for x in range(n, 0, -1) if x % 2 == 1]
		m = [4, 2]
		u = [x for x in range(6, n + 1, 2)]
		print(*i + m + u)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		arr = []
		for x in range(1, n + 1, 2):
			arr.append(str(x))
		arr = arr[::-1]
		arr.append('4')
		arr.append('2')
		i = 6
		while i <= n:
			arr.append(str(i))
			i += 2
		print(' '.join(arr))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import copy
t = int(input())
l4 = [2, 4, 1, 3]
l5 = [2, 4, 1, 3, 5]
l6 = [5, 3, 6, 2, 4, 1]
l6.reverse()
l7 = [5, 1, 3, 6, 2, 4, 7]
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	if n % 4 == 0:
		l = copy.deepcopy(l4)
		for i in range(4, n, 4):
			for j in l4:
				l.append(j + i)
	elif n % 4 == 1:
		l = copy.deepcopy(l5)
		for i in range(5, n, 4):
			for j in l4:
				l.append(j + i)
	elif n % 4 == 2:
		l = copy.deepcopy(l6)
		for i in range(6, n, 4):
			for j in l4:
				l.append(j + i)
	else:
		l = copy.deepcopy(l7)
		for i in range(7, n, 4):
			for j in l4:
				l.append(j + i)
	print(*l)


from collections import deque
tcs = int(input())
for tc in range(tcs):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	ans = deque(['3', '1', '4', '2'])
	for i in range(5, n + 1):
		if i % 2 == 1:
			ans.insert(0, str(i))
		else:
			ans.append(str(i))
	print(' '.join(ans))


b77 = 'abcdefghijklmnopqrstuvwxyz'
arr = []
d = []
count = 0
t = int(input())
for i in range(t):
	a = [2, 4, 1, 3]
	n = int(input())
	if n < 4:
		print(-1)
	else:
		for j in range(5, n + 1):
			if j % 2 == 1:
				a.append(j)
			else:
				a.insert(0, j)
		for j in range(n):
			print(a[j], end=' ')
		print()


cases = int(input())
for iii in range(cases):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	if n % 4 == 0:
		for i in range(n // 4):
			print(f'{2 + i * 4}', end=' ')
			print(f'{4 + i * 4}', end=' ')
			print(f'{1 + i * 4}', end=' ')
			print(f'{3 + i * 4}', end=' ')
		print()
	elif n % 4 == 1:
		for i in range(n // 4):
			print(f'{2 + i * 4}', end=' ')
			print(f'{4 + i * 4}', end=' ')
			print(f'{1 + i * 4}', end=' ')
			print(f'{3 + i * 4}', end=' ')
		print(n)
	elif n % 4 == 2:
		for i in range(n // 4 - 1):
			print(f'{2 + i * 4}', end=' ')
			print(f'{4 + i * 4}', end=' ')
			print(f'{1 + i * 4}', end=' ')
			print(f'{3 + i * 4}', end=' ')
		print(n - 4, end=' ')
		print(n - 1, end=' ')
		print(n - 5, end=' ')
		print(n - 3, end=' ')
		print(n, end=' ')
		print(n - 2)
	else:
		for i in range(n // 4 - 1):
			print(f'{2 + i * 4}', end=' ')
			print(f'{4 + i * 4}', end=' ')
			print(f'{1 + i * 4}', end=' ')
			print(f'{3 + i * 4}', end=' ')
		print(n - 5, end=' ')
		print(n - 2, end=' ')
		print(n - 6, end=' ')
		print(n - 4, end=' ')
		print(n, end=' ')
		print(n - 3, end=' ')
		print(n - 1)


import sys
import math

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	n = int(ii())
	if n == 2 or n == 3:
		print(-1)
		return
	if n == 4:
		print(3, 1, 4, 2)
		return
	ans = []
	for i in range(1, n + 1, 2):
		ans += [i]
	for i in range(n - n % 2, 1, -2):
		ans += [i]
	if n % 2 == 0:
		(ans[n // 2], ans[n // 2 + 1], ans[n // 2 + 2]) = (ans[n // 2 + 2], ans[n // 2], ans[n // 2 + 1])
	else:
		(ans[n // 2 + 1], ans[n // 2 + 2]) = (ans[n // 2 + 2], ans[n // 2 + 1])
	print(*ans)
	return
for ______ in range(int(ii())):
	solve_of_problem()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	j = 2
	if n <= 3:
		print('-1')
	else:
		while j <= n:
			l.append(j)
			j += 4
		if j + 2 <= n:
			j = j + 2
		elif j - 4 == n:
			j = n - 2
		elif j - 3 == n:
			j = n - 3
		else:
			j = j - 2
		while j >= 4:
			l.append(j)
			j -= 4
		j = 1
		while j <= n:
			l.append(j)
			j += 2
		for k in l:
			print(k, end=' ')
		print()


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
x = 999 // 2
a = [0] * 1000
(a[x], a[x + 2], a[x - 1], a[x + 1]) = (1, 2, 3, 4)
i = x - 2
j = x + 3
v = 5
while i >= 0 and j < 1000:
	a[i] = v
	a[j] = v + 1
	v += 2
	i -= 1
	j += 1
test_case = ii()
while test_case:
	test_case -= 1
	n = ii()
	if n < 4:
		print(-1)
	else:
		(l, r) = (498, 502)
		if n % 2:
			l -= 1
			n -= 1
		x = (n - 4) // 2
		l -= x
		r += x
		print(*a[l:r])


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(-1)
		continue
	if n == 3:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	if n == 5:
		print(1, 3, 5, 2, 4)
		continue
	if n % 2 == 0:
		for i in range(n // 2):
			print(i * 2 + 1, end=' ')
		print(n - 4, n, n - 2, end=' ')
		for i in range(n // 2 - 3):
			print(n - 6 - 2 * i, end=' ')
		print()
	if n % 2 == 1:
		for i in range(n // 2 + 1):
			print(i * 2 + 1, end=' ')
		print(n - 3, n - 1, end=' ')
		for i in range(n // 2 - 2):
			print(n - 5 - 2 * i, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	s = ''
	if n <= 3:
		print(-1)
		continue
	if n % 2 == 0:
		for j in range(2, n + 2, 2):
			s += str(j) + ' '
		s += str(n - 3) + ' ' + str(n - 1)
		for j in range(n - 5, -1, -2):
			s += ' ' + str(j)
		print(s)
	else:
		for j in range(1, n + 2, 2):
			s += str(j) + ' '
		s += str(n - 3) + ' ' + str(n - 1)
		for j in range(n - 5, 0, -2):
			s += ' ' + str(j)
		print(s)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ans = []
	if n % 2 == 0:
		for i in range(1, n // 2 + 1):
			ans.append(2 * i)
		ans.append(n - 3)
		ans.append(n - 1)
		if n >= 6:
			ans.append(n - 5)
			while True:
				i = ans[-1] - 2
				if i >= 1:
					ans.append(i)
				else:
					break
	else:
		for i in range(n // 2 + 1):
			ans.append(2 * i + 1)
		ans.append(n - 3)
		ans.append(n - 1)
		if n >= 6:
			ans.append(n - 5)
			while True:
				i = ans[-1] - 2
				if i >= 1:
					ans.append(i)
				else:
					break
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		odd = [x for x in range(n, 0, -1) if x & 1 == 1]
		mid = [4, 2]
		even = [x for x in range(6, n + 1, 2)]
		print(*odd + mid + even)


for _ in range(int(input())):
	n = int(input())
	temp = n
	ans = []
	if n < 4:
		print('-1')
		continue
	while temp >= 1:
		if temp % 2 == 0:
			temp -= 1
		else:
			ans.append(temp)
			temp -= 2
	ans.extend([4, 2])
	v = 6
	while v <= n:
		ans.append(v)
		v += 2
	for i in ans:
		print(i, end=' ')
	print()


t = int(input())
while t:
	n = int(input())
	per4 = [2, 4, 1, 3]
	q = n // 4
	r = n % 4
	for k in range(1, q):
		for i in range(4):
			per4.append(4 * k + per4[i])
	if r > 0:
		per4.append(per4[-1] + 2)
	if r > 1:
		per4.insert(-4, per4[-1] + 1)
	if r > 2:
		per4.append(per4[-1] + 2)
	if n >= 4:
		for j in per4:
			print(j, end=' ')
	else:
		print(-1)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	if n <= 3:
		print('-1')
	elif n == 4:
		print(*[3, 1, 4, 2])
	elif n == 5:
		print(*[1, 4, 2, 5, 3])
	elif n % 2 == 0:
		for j in range((n - 4) // 2):
			ans.append(2 + j * 2)
		ans.append(n - 1)
		ans.append(n - 3)
		ans.append(n)
		ans.append(n - 2)
		ans.append(n - 5)
		for j in range(1, (n - 6) // 2 + 1):
			ans.append(n - 5 - j * 2)
		print(*ans)
	else:
		for j in range((n - 3) // 2):
			ans.append(2 + j * 2)
		ans.append(n - 1)
		ans.append(n - 4)
		ans.append(n)
		ans.append(n - 2)
		ans.append(n - 6)
		for j in range(1, (n - 7) // 2 + 1):
			ans.append(n - 6 - j * 2)
		print(*ans)


for _ in range(int(input())):
	N = int(input())
	if N == 2 or N == 3:
		print(-1)
	elif N == 4:
		L = [3, 1, 4, 2]
		print(*L)
	elif N == 5:
		L = [3, 1, 5, 2, 4]
		print(*L)
	else:
		odd = []
		even = []
		for i in range(1, N + 1):
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		L = odd[::-1] + even[:]
		for i in range(N):
			if L[i] == 1 and L[i + 1] == 2:
				L.insert(i + 1, 4)
				break
		for i in range(N, 0, -1):
			if L[i] == 4:
				L[i] = -1
				break
		for i in range(N + 1):
			if L[i] > 0:
				print(L[i], end=' ')
		print()


n = int(input())
while n > 0:
	a = int(input())
	if a > 3:
		b = []
		if a % 2 == 1:
			for i in range(1, a + 1, 2):
				b.append(a - i + 1)
			for i in range(2, a, 2):
				b.append(i)
		else:
			for i in range(1, a + 1, 2):
				b.append(a - i)
			for i in range(2, a + 1, 2):
				b.append(i)
		j = b.index(2)
		b[j] = 4
		b[j + 1] = 2
		for i in range(len(b)):
			print(b[i], end=' ')
		print()
	else:
		print(-1)
	n -= 1


def parse(s):
	return [int(n) for n in s.split(' ')]
magic = [parse('1 3 5 2 4'), parse('1 3 5 2 4 6'), parse('1 3 6 2 4 7 5'), parse('1 3 6 2 4 7 5 8'), parse('1 3 6 2 4 8 5 7 9')]
for t in range(int(input())):
	n = int(input())
	if n == 1:
		ans = [1]
	elif n <= 3:
		ans = None
	elif n == 4:
		ans = [2, 4, 1, 3]
	else:
		mod = 5
		extra = 0
		rest = n
		ans = []
		while rest >= 2 * mod:
			ans += [v + extra for v in magic[0]]
			extra += mod
			rest -= mod
		ans += [v + extra for v in magic[rest % mod]]
	if ans is None:
		print(-1)
	else:
		print(' '.join((str(v) for v in ans)))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(input())
	seq = [int(k) for k in range(1, n + 1)]
	if n == 2 or n == 3:
		print(-1)
	else:
		loop = n // 5
		rem = n % 5
		lis = []
		for i in range(loop):
			if i % 2 == 0:
				for j in range(5 * i, 5 * (i + 1)):
					if j % 2 == 0:
						lis.append(seq[j])
				for j in range(5 * i, 5 * (i + 1)):
					if j % 2 != 0:
						lis.append(seq[j])
			else:
				for j in range(5 * i, 5 * (i + 1)):
					if j % 2 != 0:
						lis.append(seq[j])
				for j in range(5 * i, 5 * (i + 1)):
					if j % 2 == 0:
						lis.append(seq[j])
		if rem == 2:
			el = lis[-1]
			lis.remove(el)
			val1 = seq[n - rem]
			val2 = seq[n - rem + 1]
			lis.append(val1)
			lis.append(el)
			lis.append(val2)
		elif rem == 3:
			el = lis[-1]
			lis.remove(el)
			val1 = seq[n - rem]
			val2 = seq[n - rem + 1]
			val3 = seq[n - rem + 2]
			lis.append(val1)
			lis.append(val3)
			lis.append(el)
			lis.append(val2)
		elif rem == 4:
			val1 = seq[n - rem]
			val2 = seq[n - rem + 1]
			val3 = seq[n - rem + 2]
			val4 = seq[n - rem + 3]
			lis.append(val2)
			lis.append(val4)
			lis.append(val1)
			lis.append(val3)
		else:
			for j in range(n - rem, n):
				if j % 2 != 0:
					lis.append(seq[j])
			for j in range(n - rem, n):
				if j % 2 == 0:
					lis.append(seq[j])
		print(*lis)


def perm(k):
	if k == 5:
		return [1, 4, 2, 5, 3]
	if k == 6:
		return [1, 4, 2, 5, 3, 6]
	if k == 7:
		return [1, 4, 2, 6, 3, 7, 5]
	if k == 8:
		return [1, 5, 2, 6, 3, 7, 4, 8]
	return []
tests = int(input())
for test in range(tests):
	n = int(input())
	ans = []
	if n <= 3:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	i = 1
	while True:
		if 5 <= n - i + 1 <= 8:
			extra = perm(n - i + 1)
			for j in range(len(extra)):
				extra[j] += i - 1
			ans.extend(extra)
			break
		ans.extend([i + 1, i + 3, i, i + 2])
		i += 4
	for x in ans:
		print(x, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		ans = []
		if n % 2 == 0:
			for i in range(2, n + 1, 2):
				ans.append(i)
			ans.append(n - 3)
			ans.append(n - 1)
			for i in range(n - 5, 0, -2):
				ans.append(i)
		else:
			for i in range(1, n + 1, 2):
				ans.append(i)
			ans.append(n - 3)
			ans.append(n - 1)
			for i in range(n - 5, 0, -2):
				ans.append(i)
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	for i in reversed(range(1, n + 1)):
		if i % 2 == 1:
			print(i, end=' ')
	print(4, 2, end=' ')
	for i in range(6, n + 1):
		if i % 2 == 0:
			print(i, end=' ')
	print('')


def solve(n):
	if n < 4:
		print(-1)
		return
	if n & 1 == 0:
		a = n - 1
	else:
		a = n
	for i in range(a, 0, -2):
		print(i, end=' ')
	print('4 2', end=' ')
	for i in range(6, n + 1, 2):
		print(i, end=' ')
	print()
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	n = int(input())
	ans = []
	k = n // 2 * 2
	for i in range(k, 5, -2):
		ans.append(i)
	ans += [2, 4]
	for i in range(1, n + 1, 2):
		ans.append(i)
	if n > 3:
		print(*ans)
	else:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	elif n == 4:
		print('3 1 4 2')
		continue
	ans = []
	for j in range(1, n + 1, 2):
		ans.append(j)
	odd_last = ans[-1]
	ans.append(odd_last - 3)
	if n % 2:
		ans.append(n - 1)
	else:
		ans.append(n)
		ans.append(n - 2)
	for j in range(odd_last - 5, 1, -2):
		ans.append(j)
	for elem in ans:
		print(elem, end=' ')
	print('')


for i in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	mid = '3 1 4 2'
	if n == 4:
		print(mid)
		continue
	ans = mid
	for i in range(5, n + 1):
		if i & 1:
			ans = ans + ' ' + str(i)
		else:
			ans = str(i) + ' ' + ans
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		i = 1
		l = []
		while i <= n:
			print(i, end=' ')
			i += 2
		p = []
		i = 2
		while i <= n:
			p.append(i)
			i += 2
		x = len(p)
		if n % 2 == 0:
			y = n - 1
		else:
			y = n
		for j in range(x - 1, -1, -1):
			if abs(y - p[j]) in [2, 3, 4]:
				print(p[j], end=' ')
				p.pop(j)
				break
		for j in range(x - 2, -1, -1):
			print(p[j], end=' ')
		print()


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print(2, 4, 1, 3)
	elif n == 5:
		print(1, 4, 2, 5, 3)
	else:
		ans = deque([n - 5, n - 2, n, n - 3, n - 1, n - 4])
		(x, y) = (n - 6, n - 7)
		while True:
			if x <= 0:
				break
			ans.append(x)
			x -= 2
		while True:
			if y <= 0:
				break
			ans.appendleft(y)
			y -= 2
		print(*ans)


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
t = ni()
for i in range(t):
	n = ni()
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		a = [3, 1, 4, 2]
		f = 0
		for j in range(5, n + 1):
			if f == 0:
				a.insert(0, j)
			else:
				a.append(j)
			f = 1 - f
		for j in a:
			print(j, end=' ')
		print()


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
			continue
		res = []
		for i in range(n // 4):
			res += [x + i * 4 for x in [2, 4, 1, 3]]
		res += [i for i in range(n // 4 * 4 + 1, n + 1)]
		if n % 4 == 2:
			(res[-2], res[-3]) = (res[-3], res[-2])
		elif n % 4 == 3:
			p = [-7, -2, -6, -1, -3, -4, -5]
			tmp = list(map(lambda x: res[p[x]], range(7)))
			res = res[:-7] + tmp
		print(' '.join(map(str, res)))
main()


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	x = n - (n % 2 == 0)
	an = []
	while x > 0:
		an.append(x)
		x -= 2
	an.append(4)
	an.append(2)
	k = len(an)
	x = 6
	while k < n:
		an.append(x)
		k += 1
		x += 2
	print(*an)


def permute(n):
	if n <= 3:
		print(-1)
		return
	blocks = n // 4
	remainder = n - 4 * blocks
	ret = []
	if remainder == 0:
		ret = [n - 1, n - 3, n, n - 2]
	elif remainder == 1:
		ret = [n, n - 2, n - 4, n - 1, n - 3]
	elif remainder == 2:
		ret = [n, n - 3, n - 1, n - 5, n - 2, n - 4]
	elif remainder == 3:
		ret = [n - 1, n - 4, n, n - 2, n - 6, n - 3, n - 5]
	for b in range(blocks - 2, -1, -1):
		ret.append(4 * b + 3)
		ret.append(4 * b + 1)
		ret.append(4 * b + 4)
		ret.append(4 * b + 2)
	print(' '.join(map(str, ret)))
t = int(input())
for i in range(t):
	permute(int(input()))


import sys

def test():
	stdin = sys.stdin
	sys.stdin = open('input.txt')
	main()
	sys.stdin = stdin

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
		else:
			if n % 2 == 0:
				odd = list(range(n - 1, 0, -2))
				even = [4, 2] + list(range(6, n + 1, 2))
			else:
				odd = list(range(n, 0, -2))
				even = [4, 2] + list(range(6, n, 2))
			ans = odd + even
			print(*ans, sep=' ')
main()


a = [2, 4, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, 401, 405, 409, 413, 417, 421, 425, 429, 433, 437, 441, 445, 449, 453, 457, 461, 465, 469, 473, 477, 481, 485, 489, 493, 497, 501, 505, 509, 513, 517, 521, 525, 529, 533, 537, 541, 545, 549, 553, 557, 561, 565, 569, 573, 577, 581, 585, 589, 593, 597, 601, 605, 609, 613, 617, 621, 625, 629, 633, 637, 641, 645, 649, 653, 657, 661, 665, 669, 673, 677, 681, 685, 689, 693, 697, 701, 705, 709, 713, 717, 721, 725, 729, 733, 737, 741, 745, 749, 753, 757, 761, 765, 769, 773, 777, 781, 785, 789, 793, 797, 801, 805, 809, 813, 817, 821, 825, 829, 833, 837, 841, 845, 849, 853, 857, 861, 865, 869, 873, 877, 881, 885, 889, 893, 897, 901, 905, 909, 913, 917, 921, 925, 929, 933, 937, 941, 945, 949, 953, 957, 961, 965, 969, 973, 977, 981, 985, 989, 993, 997, 999, 995, 991, 987, 983, 979, 975, 971, 967, 963, 959, 955, 951, 947, 943, 939, 935, 931, 927, 923, 919, 915, 911, 907, 903, 899, 895, 891, 887, 883, 879, 875, 871, 867, 863, 859, 855, 851, 847, 843, 839, 835, 831, 827, 823, 819, 815, 811, 807, 803, 799, 795, 791, 787, 783, 779, 775, 771, 767, 763, 759, 755, 751, 747, 743, 739, 735, 731, 727, 723, 719, 715, 711, 707, 703, 699, 695, 691, 687, 683, 679, 675, 671, 667, 663, 659, 655, 651, 647, 643, 639, 635, 631, 627, 623, 619, 615, 611, 607, 603, 599, 595, 591, 587, 583, 579, 575, 571, 567, 563, 559, 555, 551, 547, 543, 539, 535, 531, 527, 523, 519, 515, 511, 507, 503, 499, 495, 491, 487, 483, 479, 475, 471, 467, 463, 459, 455, 451, 447, 443, 439, 435, 431, 427, 423, 419, 415, 411, 407, 403, 399, 395, 391, 387, 383, 379, 375, 371, 367, 363, 359, 355, 351, 347, 343, 339, 335, 331, 327, 323, 319, 315, 311, 307, 303, 299, 295, 291, 287, 283, 279, 275, 271, 267, 263, 259, 255, 251, 247, 243, 239, 235, 231, 227, 223, 219, 215, 211, 207, 203, 199, 195, 191, 187, 183, 179, 175, 171, 167, 163, 159, 155, 151, 147, 143, 139, 135, 131, 127, 123, 119, 115, 111, 107, 103, 99, 95, 91, 87, 83, 79, 75, 71, 67, 63, 59, 55, 51, 47, 43, 39, 35, 31, 27, 23, 19, 15, 11, 7, 3, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, 994, 996, 998, 1000]
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		print(*sorted(range(1, n + 1), key=lambda i: a.index(i)))


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		r = list(range(1, n + 1, 2))[::-1] + [4, 2] + list(range(6, n + 1, 2))
		print(*r)


t = int(input())
if t < 1 or t > 100:
	exit()
else:
	dup = []
	for i in range(t):
		n = int(input())
		dup.append(n)
	l = []
	for i in range(t):
		if dup[i] < 2 or dup[i] > 1000:
			print(-1)
			continue
		elif dup[i] == 2 or dup[i] == 3:
			print(-1)
			continue
		else:
			for j in range(dup[i] + 1):
				if j == 0:
					continue
				elif j < dup[i] + 1:
					l.append(j)
			k = []
			for j in range(int(dup[i])):
				if dup[i] % 2 == 0 and dup[i] > 5:
					if j == 0:
						continue
					elif j % 2 != 0:
						k.append(l[j])
						if j % 2 != 0 and j == dup[i] - 1:
							k.append(l[j - 3])
							k.append(l[j - 1])
							k.append(l[j - 5])
							for a in reversed(range(l[j] - 6)):
								if a % 2 == 0:
									k.append(l[a])
				elif dup[i] % 2 != 0 and dup[i] > 5:
					if j % 2 == 0:
						k.append(l[j])
						if j % 2 == 0 and j == dup[i] - 1:
							k.append(l[j - 3])
							k.append(l[j - 1])
							k.append(l[j - 5])
							for a in reversed(range(l[j] - 6)):
								if a % 2 != 0:
									k.append(l[a])
				elif dup[i] == 4:
					if j == 0:
						k.append(l[j + 1])
						k.append(l[j + 3])
						k.append(l[j])
						k.append(l[j + 2])
				elif dup[i] == 5:
					if j == 0:
						k.append(l[j])
						k.append(l[j + 2])
						k.append(l[j + 4])
						k.append(l[j + 1])
						k.append(l[j + 3])
				else:
					continue
			if k == []:
				l = []
				continue
			else:
				s = ', '.join((repr(e) for e in k))
				l = []
				s = s.replace(',', '')
				print(s)


test_size = int(input())
n_arr = []
for i in range(test_size):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		res_str = '3 1 4 2'
		for num in range(5, n + 1):
			res_str = f'{str(num)} {res_str}' if num % 2 == 0 else f'{res_str} {str(num)}'
		print(res_str)


a = int(input())
for ifei in range(a):
	val = int(input())
	if val == 2 or val == 3:
		print('-1')
	else:
		lst = [3, 1, 4, 2]
		for i in range(val - 4):
			i = i + 5
			if i % 2 == 1:
				lst.append(i)
			else:
				v1 = i - 2
				v2 = i - 4
				ind1 = lst.index(v1)
				ind2 = lst.index(v2)
				ind = max(ind1, ind2)
				lst.insert(ind, i)
		lst = [str(j) for j in lst]
		print(' '.join(lst))


for _ in range(int(input())):
	n = int(input())
	if n == 4:
		print('3 1 4 2')
		continue
	if n < 4:
		print(-1)
		continue
	i = 1
	a = []
	while i <= n:
		a.append(i)
		print(i, end=' ')
		i += 2
	i -= 5
	while i > 0:
		a.append(i)
		print(i, end=' ')
		i -= 4
	if i + 2 > 0:
		a.append(i + 2)
		print(i + 2, end=' ')
	i += 6
	while i <= n:
		a.append(i)
		print(i, end=' ')
		i += 4
	if len(a) != n:
		print(i - 2, end=' ')
	print()


T = int(input())
r = 1
while r <= T:
	n = int(input())
	if n < 4:
		print(-1)
		r += 1
		continue
	if n == 4:
		print(3, 1, 4, 2)
		r += 1
		continue
	block = [3, 1, 5, 2, 4]
	rest = n % 5
	ans = []
	for i in range(n // 5 - 1):
		ans += [3 + 5 * i, 1 + 5 * i, 5 + 5 * i, 2 + 5 * i, 4 + 5 * i]
	rest = n % 5 + 5
	base = [5 * (n // 5 - 1)] * rest
	if n % 5 == 0:
		arr = [3, 1, 5, 2, 4]
	if n % 5 == 1:
		arr = [3, 1, 5, 2, 4, 6]
	if n % 5 == 2:
		arr = [3, 1, 4, 6, 2, 5, 7]
	if n % 5 == 3:
		arr = [3, 1, 4, 2, 6, 8, 5, 7]
	if n % 5 == 4:
		arr = [3, 1, 5, 2, 4, 8, 6, 9, 7]
	for i in range(rest):
		base[i] += arr[i]
	ans += base
	print(' '.join(map(str, ans)))
	r += 1


import itertools
perms = {}
for t in range(1, 10):
	l = list(itertools.permutations([i for i in range(1, t + 1)]))
	perms[t] = l

def is_good_perm(perm):
	n = len(perm)
	for i in range(n - 1):
		a = abs(perm[i] - perm[i + 1])
		if a >= 2 and a <= 4:
			continue
		else:
			return False
	return True
T = int(input())
for t in range(T):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		nb_multiple_5 = n // 5
		if nb_multiple_5 > 1:
			remaining_numbers = n - (nb_multiple_5 - 1) * 5
			res = []
			for i in range(nb_multiple_5 - 1):
				s = [1, 4, 2, 5, 3]
				s = list(map(lambda x: x + 5 * i, s))
				res += s
			assert remaining_numbers < 10
			for perm in perms[remaining_numbers]:
				if is_good_perm(perm):
					perm = list(perm)
					perm = list(map(lambda x: x + 5 * (nb_multiple_5 - 1), perm))
					res += list(perm)
					break
		else:
			for perm in perms[n]:
				if is_good_perm(perm):
					res = perm
					break
		print(' '.join(map(str, res)))


def g(n):
	if n in (4, 5):
		m = 2
	else:
		m = n - n % 2
	mp = {6: 2, 2: 4, 4: 1}
	while m <= n:
		yield m
		if m in mp:
			m = mp[m]
		elif m % 2 == 1:
			m += 2
		else:
			m -= 2
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	print(-1 if n < 4 else ' '.join(map(str, list(g(n)))))


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		ans = []
		l = n
		if n % 2 == 0:
			l = n - 1
		while l > 0:
			ans.append(l)
			l -= 2
		ans.append(4)
		ans.append(2)
		x = 6
		while x <= n:
			ans.append(x)
			x += 2
		for i in ans:
			print(i, end=' ')
		print('')


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	ansls = list()
	if n % 2:
		now = n - 1
	else:
		now = n
	while now > 4:
		ansls.append(now)
		now -= 2
	ansls.append(2)
	ansls.append(4)
	now = 1
	while now <= n:
		ansls.append(now)
		now += 2
	print(*ansls)


import sys
input = sys.stdin.readline
for T in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	elif n == 5:
		print('1 4 2 5 3')
	elif n == 6:
		print('1 3 5 2 4 6')
	elif n == 7:
		print('1 3 5 7 4 6 2')
	elif n == 8:
		print('1 4 8 6 3 7 5 2')
	elif n % 2 == 1:
		t = [x for x in range(1, n + 1, 2)]
		t += [n - 3, n - 1]
		t += [x for x in range(n - 5, 1, -2)]
		print(*t)
	else:
		t = [x for x in range(1, n, 2)]
		t += [n - 4, n, n - 2]
		t += [x for x in range(n - 6, 1, -2)]
		print(*t)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 3:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	k = n
	if k % 2 == 0:
		l = k // 2
		for i in range(l):
			print(k, end=' ')
			k -= 2
		if n == 6:
			print(5, 1, 3, end=' ')
			print()
			continue
		if n == 8:
			print(5, 1, 3, 7, end=' ')
			print()
			continue
		else:
			print(5, 1, 3, 7, end=' ')
			j = 4
			for i in range(l - 4):
				print(2 * j + 1, end=' ')
				j += 1
			print()
	else:
		l = k // 2
		for i in range(l):
			print(k - 1, end=' ')
			k -= 2
		if n == 5:
			print(5, 1, 3, end=' ')
			print()
			continue
		if n == 7:
			print(5, 1, 3, 7, end=' ')
			print()
			continue
		else:
			print(5, 1, 3, 7, end=' ')
			j = 4
			for i in range(l + 1 - 4):
				print(2 * j + 1, end=' ')
				j += 1
			print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	dup = n
	if n & 1 == 0:
		n -= 1
	while n >= 1:
		print(n, end=' ')
		n -= 2
	print('4 2', end=' ')
	num = 6
	if dup & 1 != 0:
		dup -= 1
	while num <= dup:
		print(num, end=' ')
		num += 2
	print(' ')


T = int(input())
for t in range(T):
	n = int(input())
	if n in [2, 3]:
		print(-1)
		continue
	A = []
	B = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			A.append(i)
		else:
			B.append(i)
	if n & 1:
		(A, B) = (B, A)
	P = [x for x in A]
	if len(B) > 1:
		P.append(B[-2])
	if len(B):
		P.append(B[-1])
	P.extend(B[:-2][::-1])
	print(' '.join(map(str, P)))


def solve(n):
	if n == 2 or n == 3:
		print(-1)
		return
	if n == 4:
		print(' '.join(list(map(str, [2, 4, 1, 3]))))
		return
	if n == 5:
		print(' '.join(list(map(str, [1, 3, 5, 2, 4]))))
		return
	if n == 6:
		print(' '.join(list(map(str, [1, 4, 6, 3, 5, 2]))))
		print()
	else:
		arr1 = []
		arr2 = []
		for i in range(1, n + 1):
			if i % 2 == 1:
				arr1.append(i)
			else:
				arr2.append(i)
		if n % 2 == 1:
			t1 = arr2.pop()
			t2 = arr2.pop()
			arr2.append(t1)
			arr2.append(t2)
			arr2 = arr2[::-1]
			print(' '.join(list(map(str, arr1 + arr2))))
		else:
			t1 = arr1.pop()
			t2 = arr1.pop()
			t3 = arr2.pop()
			t4 = arr2.pop()
			arr1.append(t4)
			arr1.append(t3)
			arr2.append(t1)
			arr2.append(t2)
			arr2 = arr2[::-1]
			print(' '.join(list(map(str, arr1 + arr2))))
T = int(input())
for ti in range(1, T + 1):
	n = int(input())
	solve(n)


from itertools import accumulate
t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		ans = []
		if n % 2 == 0:
			for i in range(1, n - 4, 2):
				ans.append(i)
			ans.append(i + 2)
			ans.append(i + 4)
			ans.append(i + 1)
			ans.append(i + 5)
			ans.append(i + 3)
			for i in range(n - 6, 0, -2):
				ans.append(i)
		else:
			for i in range(1, n - 3, 2):
				ans.append(i)
			ans.append(i + 2)
			ans.append(i + 4)
			ans.append(i + 1)
			ans.append(i + 3)
			for i in range(n - 5, 0, -2):
				ans.append(i)
		print(*ans)


t = int(input())
answers = []
for _ in range(t):
	n = int(input())
	ans = list(range(1, n + 1))
	if n < 4:
		print(-1)
		continue
	elif n % 4 == 0:
		for i in range(n // 4):
			(ans[4 * i + 0], ans[4 * i + 1]) = (ans[4 * i + 1], ans[4 * i + 0])
			(ans[4 * i + 2], ans[4 * i + 3]) = (ans[4 * i + 3], ans[4 * i + 2])
			(ans[4 * i + 1], ans[4 * i + 2]) = (ans[4 * i + 2], ans[4 * i + 1])
	elif n % 4 == 1 or n % 4 == 2:
		for i in range(n // 4):
			(ans[1 + 4 * i + 0], ans[1 + 4 * i + 1]) = (ans[1 + 4 * i + 1], ans[1 + 4 * i + 0])
			(ans[1 + 4 * i + 2], ans[1 + 4 * i + 3]) = (ans[1 + 4 * i + 3], ans[1 + 4 * i + 2])
			(ans[1 + 4 * i + 1], ans[1 + 4 * i + 2]) = (ans[1 + 4 * i + 2], ans[1 + 4 * i + 1])
	elif n % 4 == 3:
		for i in range(n // 4):
			(ans[1 + 4 * i + 0], ans[1 + 4 * i + 1]) = (ans[1 + 4 * i + 1], ans[1 + 4 * i + 0])
			(ans[1 + 4 * i + 2], ans[1 + 4 * i + 3]) = (ans[1 + 4 * i + 3], ans[1 + 4 * i + 2])
			(ans[1 + 4 * i + 1], ans[1 + 4 * i + 2]) = (ans[1 + 4 * i + 2], ans[1 + 4 * i + 1])
		(ans[-2], ans[-3]) = (ans[-3], ans[-2])
	print(*ans, sep=' ')


def solve():
	n = int(input())
	if n < 4:
		print(-1)
		return
	evens = list(range(6, n + 1, 2))
	odds = list(reversed(range(1, n + 1, 2)))
	ans = []
	for i in range(len(odds)):
		ans.append(odds[i])
	ans.append(4)
	ans.append(2)
	for i in range(len(evens)):
		ans.append(evens[i])
	print(*ans)
	return
numcases = int(input())
for i in range(numcases):
	solve()


for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		ans = []
		for i in range(1, n + 1, 2):
			ans.append(i)
		last = ans[-1] - 3
		ans.append(last)
		if n % 2 == 0:
			cur = n
		else:
			cur = n - 1
		while cur > last:
			ans.append(cur)
			cur -= 2
		for i in range(cur - 2, 0, -2):
			ans.append(i)
		print(*ans)


for T in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		ans = []
		for id in range(6, n + 1, 2):
			ans.append(id)
		ans.reverse()
		ans.append(2)
		ans.append(4)
		for id in range(1, n + 1, 2):
			ans.append(id)
		for x in ans:
			print(x, end=' ')
		print('\n', end='')


def special_permutation(n):
	array = list(range(1, n + 1, 2))
	array.append(array[-1] - 3)
	if n % 2 == 0:
		next_array = list(range(n, 0, -2))
		next_array.remove(array[-1])
	else:
		next_array = list(range(n - 1, 0, -2))
		next_array.remove(array[-1])
	print(*array + next_array)
t = int(input())
for i in range(t):
	n = int(input())
	if n == 4:
		print(*[3, 1, 4, 2])
	elif n > 4:
		special_permutation(n)
	else:
		print(-1)


from functools import cmp_to_key

class Solution:

	def __init__(self):
		test = int(input())
		for t in range(0, test):
			n = int(input())
			self.solve(n)

	def solve(self, n):

		def cmp(a, b):
			x = len(f[a])
			y = len(f[b])
			return (x > y) - (x < y)
		f = [[] for i in range(0, n)]
		for i in range(0, n):
			for j in range(2, 5):
				if i + j >= 0 and i + j < n:
					f[i].append(i + j)
					f[i + j].append(i)
		res = []
		can = [i for i in range(0, n)]
		while len(res) < n:
			if not can:
				print('-1')
				return
			smallest = min(can, key=cmp_to_key(cmp))
			res.append(smallest)
			can = f[smallest]
			for i in can:
				f[i].remove(smallest)
		print(' '.join(list(map(str, [i + 1 for i in res]))))
Solution()


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	if n < 4:
		print(-1)
	else:
		out = []
		if n == 4:
			print('3 1 4 2')
		elif n % 2 == 0:
			for i in range(2, n + 1, 2):
				out.append(i)
			out.append(n - 3)
			out.append(n - 1)
			out.append(n - 5)
			for i in range(n - 7, 0, -2):
				out.append(i)
			print(' '.join([str(x) for x in out]))
		elif n == 5:
			print('4 2 5 3 1')
		else:
			for i in range(2, n - 5, 2):
				out.append(i)
			out.append(n - 5)
			out.append(n - 1)
			out.append(n - 3)
			for i in range(n, 0, -2):
				out.append(i)
			print(' '.join([str(x) for x in out]))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		curr = 1
		while curr <= n:
			print(curr, end=' ')
			curr += 2
		if n % 2 != 0:
			curr = n - 3
			print(curr, end=' ')
			curr += 2
			print(curr, end=' ')
			curr -= 4
			if curr != 0:
				print(curr, end=' ')
			curr -= 2
			while curr >= 2:
				print(curr, end=' ')
				curr -= 2
			print()
		else:
			curr = n - 4
			print(curr, end=' ')
			curr += 4
			print(curr, end=' ')
			curr -= 2
			print(curr, end=' ')
			curr -= 4
			while curr >= 2:
				print(curr, end=' ')
				curr -= 2
			print()
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print(2, 4, 1, 3)
	else:
		ans = []
		for i in range(1, n + 1, 2):
			ans.append(i)
		if n % 2 == 0:
			i = ans[-1] - 3
			j = i + 4
			k = i + 2
			ans.append(i)
			ans.append(j)
			ans.append(k)
		else:
			i = ans[-1] - 3
			j = i + 2
			ans.append(i)
			ans.append(j)
		for i in range(i - 2, 0, -2):
			ans.append(i)
		print(*ans)


T = int(input())

def ans(n):
	if n <= 3:
		return '-1'
	if n % 3 == 2:
		left_peak = n
	else:
		left_peak = n - 1
	if left_peak % 3 == 0:
		left = list(range(2, left_peak + 1, 3))
		left[-1] += 1
		mid = list(range(3, left_peak, 3))[::-1]
		right = list(range(1, n + 1, 3))
		ans = left + mid + right + [n - 2]
		return ' '.join((str(x) for x in ans))
	else:
		left = list(range(2, left_peak + 1, 3))
		mid = list(range(3, left_peak, 3))[::-1]
		right = list(range(1, n, 3))
		adj = []
		if n % 3 == 0:
			adj = [n]
		ans = left + mid + right + adj
		return ' '.join((str(x) for x in ans))
for t in range(T):
	n = int(input())
	print(ans(n))


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	if n < 4:
		print(-1)
	else:
		a = []
		for i in range(2, n + 1):
			if i % 2 != 0:
				continue
			a.append(i)
		for i in range(n, -1, -1):
			if i % 2 != 1:
				continue
			a.append(i)
		for i in range(n):
			if abs(a[i] - a[i + 1]) < 2:
				if a[i] > a[i + 1]:
					(a[i - 1], a[i], a[i + 1], a[i + 2]) = (a[i + 1], a[i + 2], a[i], a[i - 1])
				else:
					(a[i - 1], a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i + 1], a[i - 1], a[i])
				break
		print_array(a)


for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		odds = [i for i in range(1, n + 1, 2)][::-1]
		evens = [i for i in range(2, n + 1, 2)]
		(evens[0], evens[1]) = (evens[1], evens[0])
		print(' '.join(list(map(str, odds))), end=' ')
		print(' '.join(list(map(str, evens))))


def resolve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n < 4:
			print(-1)
			continue
		ans = []
		for i in range(n // 2 * 2, 5, -2):
			ans.append(i)
		ans.append(2)
		ans.append(4)
		for i in range(1, n + 1, 2):
			ans.append(i)
		print(*ans)
resolve()


tasks = int(input())
l = []
for i in range(tasks):
	n = int(input())
	if n < 4:
		l.append('-1')
	else:
		li = ['3', '1', '4', '2']
		for j in range(4, n):
			if j % 2 == 1:
				li.append(str(j + 1))
			else:
				li.insert(0, str(j + 1))
		l.append(li)
for ls in l:
	if ls == '-1':
		print('-1')
	else:
		print(' '.join(ls))


import sys
sys.setrecursionlimit(1500)

def check(perm):
	for i in range(len(perm) - 1):
		if not 2 <= abs(perm[i] - perm[i - 1]) <= 4:
			return False
	return True
import itertools

def brute(n):
	nums = list(range(1, n + 1))
	perms = list(itertools.permutations(nums))
	for perm in perms:
		if check(perm):
			return perm
	return []

def soln(n):

	def neighbors(i):
		result = []
		for cands in [range(i - 4, i - 1), range(i + 2, i + 5)]:
			for cand in cands:
				if 1 <= cand <= n:
					result.append(cand)
		return result
	adj = {i: neighbors(i) for i in range(1, n + 1)}

	def dfs(i, currPath, seen):
		if len(currPath) == n:
			return currPath
		for j in adj[i]:
			if j not in seen:
				path = dfs(j, currPath + [j], seen | set([j]))
				if len(path) > 0:
					return path
		return []
	return dfs(1, [], set([]))

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		result = soln(n)
		if len(result) == 0:
			resultStr = '-1'
		else:
			resultStr = ' '.join((str(x) for x in result))
		print(resultStr)
main()


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
entries = inp()
for i in range(entries):
	n = inp()
	res = []
	if n < 4:
		print(-1)
	else:
		p = -1
		while p < n // 4 * 4 - 3:
			p += 3
			res.append(p)
			p += 2
			res.append(p)
			p -= 3
			res.append(p)
			p += 2
			res.append(p)
		if n % 4 == 1:
			p += 2
			res.insert(-1, p)
		elif n % 4 == 2:
			p += 2
			res.append(p)
			p += 1
			res.insert(-4, p)
		elif n % 4 == 3:
			p += 2
			res.append(p)
			p += 1
			res.insert(-4, p)
			p += 1
			res.append(p)
		ans = ''
		for x in res:
			ans += str(x)
			ans += ' '
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	if n == 4:
		print('3 1 4 2')
		continue
	ans = ''
	start = 1
	r = n % 5
	if r == 1:
		ans += '1 4 2 6 3 5 '
		start = 7
	elif r == 2:
		ans += '1 3 6 2 4 7 5 '
		start = 8
	elif r == 3:
		ans += '1 4 8 5 2 6 3 7 '
		start = 9
	elif r == 4:
		ans += '1 3 5 9 7 4 2 6 8 '
		start = 10
	for i in range(start, n + 1, 5):
		ans += str(i) + ' ' + str(i + 3) + ' ' + str(i + 1) + ' ' + str(i + 4) + ' ' + str(i + 2) + ' '
	print(ans)


t = input()
for _ in range(int(t)):
	n = int(input())
	if n <= 3:
		print('-1')
	else:
		ans = []
		start = n - n % 2
		while start > 0:
			ans.append(start)
			start = start - 2
		(ans[-1], ans[-2]) = (ans[-2], ans[-1])
		start = 1
		while start <= n:
			ans.append(start)
			start += 2
		for num in ans:
			print(num, end=' ')
		print('')


t = int(input())
par = []
impar = []
temp = 0
rpta = []
final = []
for i in range(t):
	numero = int(input())
	if numero <= 3:
		final.append(-1)
		rpta.append(final)
		final = []
	else:
		for k in range(1, numero + 1):
			if k % 2 == 0:
				par.append(k)
			else:
				impar.append(k)
		impar.reverse()
		temp = par[0]
		par[0] = par[1]
		par[1] = temp
		for j in impar:
			final.append(j)
		for y in par:
			final.append(y)
		rpta.append(final)
		final = []
		par = []
		impar = []
for xxx in rpta:
	for aaa in xxx:
		print(aaa, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		ans = []
		if n % 2 == 0:
			m = n - 1
		else:
			m = n
		for j in range((m - 1) // 2 + 1):
			ans.append(m - j * 2)
		ans.append(4)
		ans.append(2)
		for j in range(6, n + 1, 2):
			ans.append(j)
		print(*ans)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	n = int(input())
	z = []
	k = 0
	if n > 5:
		for i in range(1, n + 1, 2):
			z.append(i)
			k += 1
		f = k
		if n % 2 == 0:
			t = n
		else:
			t = n - 1
		x = []
		for i in range(t, 1, -2):
			x.append(i)
		if n % 2 != 0:
			(x[0], x[1]) = (x[1], x[0])
			print(*z, *x)
		else:
			(x[0], x[2]) = (x[2], x[0])
			(x[1], x[2]) = (x[2], x[1])
			print(*z, *x)
	elif n == 2 or n == 3:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	elif n == 5:
		print(1, 3, 5, 2, 4)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			if n == 4:
				print('2 4 1 3')
			elif n == 6:
				print('2 4 6 3 5 1')
			elif n == 8:
				print('2 4 6 8 5 7 3 1')
			elif n == 2:
				print(-1)
			else:
				for j in range(2, n + 1, 2):
					print(j, end=' ')
				print(n - 3, n - 1, n - 5, end=' ')
				for j in range(n - 7, 0, -2):
					print(j, end=' ')
				print()
		elif n == 3 or n == 1:
			print(-1)
		elif n == 5:
			print('1 3 5 2 4')
		elif n == 7:
			print('1 3 5 7 4 6 2')
		else:
			for j in range(1, n + 1, 2):
				print(j, end=' ')
			print(n - 3, n - 1, n - 5, end=' ')
			for j in range(n - 7, 1, -2):
				print(j, end=' ')
			print()
main()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(str(i)[2:-1]) for i in input().rstrip()]
for _ in range(val()):
	n = val()
	if n < 4:
		print(-1)
		continue
	l = [3, 1, 4, 2]
	l = l[::-1]
	for i in range(5, n + 1, 2):
		l.append(i)
	l = l[::-1]
	for i in range(6, n + 1, 2):
		l.append(i)
	print(*l)


t = int(input())
for q in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		lista = [2, 4, 1, 3]
		for i in range(n):
			print(lista[i], end=' ')
		print()
	else:
		lista = [2, 4, 1, 3]
		for k in range(5, n + 1):
			if k % 2 == 0:
				lista.insert(0, k)
			else:
				lista.append(k)
		for i in range(n):
			print(lista[i], end=' ')
		print()


t = int(input())
for hh in range(0, t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		li = []
		count4 = n // 4
		for i in range(0, count4):
			if i % 2 == 0:
				li.append(4 * i + 3)
				li.append(4 * i + 1)
				li.append(4 * i + 4)
				li.append(4 * i + 2)
			else:
				li.append(4 * i + 2)
				li.append(4 * i + 4)
				li.append(4 * i + 1)
				li.append(4 * i + 3)
		tot = count4 * 4
		if tot < n:
			tot += 1
			vall = tot
			for i in range(0, len(li) - 1):
				if abs(li[i] - vall) >= 2 and abs(li[i + 1] - vall) >= 2:
					if abs(li[i] - vall) <= 4 and abs(li[i + 1] - vall) <= 4:
						li.insert(i + 1, vall)
		if tot < n:
			tot += 1
			vall = tot
			for i in range(0, len(li) - 1):
				if abs(li[i] - vall) >= 2 and abs(li[i + 1] - vall) >= 2:
					if abs(li[i] - vall) <= 4 and abs(li[i + 1] - vall) <= 4:
						li.insert(i + 1, vall)
		if tot < n:
			tot += 1
			vall = tot
			for i in range(0, len(li) - 1):
				if abs(li[i] - vall) >= 2 and abs(li[i + 1] - vall) >= 2:
					if abs(li[i] - vall) <= 4 and abs(li[i + 1] - vall) <= 4:
						li.insert(i + 1, vall)
		print(*li)


from collections import deque

def solve(n):
	if n < 4:
		return -1
	q = deque()
	q.append(1)
	q.appendleft(3)
	q.append(4)
	q.append(2)
	turn = 1
	num = 5
	while num <= n:
		if turn == 1:
			q.append(num)
		else:
			q.appendleft(num)
		num += 1
		turn = 1 - turn
	return ' '.join((str(x) for x in q))
T = int(input())
for case in range(T):
	print(solve(int(input())))


x = int(input())
for i in range(x):
	n = int(input())
	l = []
	if n < 4:
		print(-1)
	else:
		if n % 2 == 0:
			for i in range(2, n + 1, 2):
				l.append(i)
			l.append(n - 3)
			for i in range(n - 1, 0, -2):
				if i not in l:
					l.append(i)
		else:
			for i in range(1, n + 1, 2):
				l.append(i)
			l.append(n - 3)
			for i in range(n - 1, 1, -2):
				if i not in l:
					l.append(i)
		for i in l:
			print(i, end=' ')


t = int(input())
for u in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	l = []
	if n % 2 == 0:
		start = 2
		for i in range(n // 2):
			l.append(start)
			start += 2
		if start - 5 > 0:
			l.append(start - 5)
		l.append(start - 3)
		if start - 7 > 0:
			l.append(start - 7)
		start = start - 9
		while start > 0:
			l.append(start)
			start -= 2
	else:
		start = 1
		for i in range(n // 2 + 1):
			l.append(start)
			start += 2
		if start - 5 > 0:
			l.append(start - 5)
		l.append(start - 3)
		if start - 7 > 0:
			l.append(start - 7)
		start = start - 9
		while start > 0:
			l.append(start)
			start -= 2
	print(*l)


from collections import deque

def read_int():
	return int(input())
t = read_int()
for case_num in range(t):
	n = read_int()
	if n <= 3:
		print(-1)
	else:
		q = deque([3, 1, 4, 2])
		for i in range(5, n + 1):
			if i % 2 == 1:
				q.append(i)
			else:
				q.appendleft(i)
		print(' '.join(map(str, list(q))))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(1)
	elif n == 2 or n == 3:
		print(-1)
	else:
		arr = []
		x = n
		goingDown = True
		for i in range(n):
			arr.append(x)
			if goingDown:
				if x == 2:
					x = 1
					goingDown = False
				elif x == 1:
					x = 2
					goingDown = False
				else:
					x -= 2
			else:
				x += 2
		two = arr.index(2)
		four = arr.index(4)
		(arr[two], arr[four]) = (arr[four], arr[two])
		print(' '.join([str(x) for x in arr]))


for _ in range(int(input())):
	n = int(input())
	if n in [2, 3]:
		print(-1)
	elif n == 4:
		print(*[2, 4, 1, 3])
	elif n == 5:
		print(*[3, 1, 4, 2, 5])
	elif n == 6:
		print(*[1, 4, 2, 5, 3, 6])
	elif n == 7:
		print(*[1, 4, 7, 5, 2, 6, 3])
	else:
		l = []
		if n % 2 == 1:
			for i in range(1, n - 2 - n % 2, 2):
				l.append(i)
			l.append(i + 3)
			l.append(i + 1)
			l.append(i + 4)
			l.append(i + 2)
			for j in range(i - 1, 1, -2):
				l.append(j)
		else:
			for i in range(2, n + 1, 2):
				l.append(i)
			l.append(i - 3)
			l.append(i - 1)
			for j in range(i - 5, 0, -2):
				l.append(j)
		print(*l)


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		if N <= 3:
			print(-1)
		elif N == 4:
			print(3, 1, 4, 2)
		elif N == 5:
			print(5, 3, 1, 4, 2)
		else:
			ans = [6, 3, 1, 4, 2, 5]
			var = 7
			while N - var >= 0:
				ans.append(var)
				var += 2
			ans = list(reversed(ans))
			var = 8
			while N - var >= 0:
				ans.append(var)
				var += 2
			print(*ans)
main()


import sys
input = sys.stdin.readline
t = int(input())
A5 = [1, 4, 2, 5, 3]
A6 = [1, 4, 2, 5, 3, 6]
A7 = [1, 5, 2, 6, 3, 7, 4]
A8 = [1, 5, 2, 6, 3, 7, 4, 8]
A9 = [1, 4, 2, 5, 3, 7, 9, 6, 8]
for tests in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	elif n == 4:
		print(3, 1, 4, 2)
		continue
	ANS = []
	now = 0
	while n:
		if n == 5:
			ANS += [a + now for a in A5]
			n -= 5
		elif n == 6:
			ANS += [a + now for a in A6]
			n -= 6
		elif n == 7:
			ANS += [a + now for a in A7]
			n -= 7
		elif n == 8:
			ANS += [a + now for a in A8]
			n -= 8
		elif n == 9:
			ANS += [a + now for a in A9]
			n -= 9
		else:
			ANS += [a + now for a in A5]
			n -= 5
			now += 5
	print(*ANS)


import sys
from math import ceil
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
for _ in range(cin()):
	n = cin()
	if n < 4:
		print(-1)
	else:
		(ans, left) = ([2, 4, 1, 3], [])
		for i in range(5, n + 1, 2):
			left.append(i)
			ans.append(i + 1)
		ans = left[::-1] + ans
		for i in range(n):
			print(ans[i], end=' ')
		print()


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	result = [3, 1, 4, 2]
	for i in range(5, n + 1):
		if i % 2 == 1:
			result.append(i)
	result.reverse()
	for i in range(5, n + 1):
		if i % 2 == 0:
			result.append(i)
	if n >= 4:
		print(' '.join((str(i) for i in result)))
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	found = False
	if n <= 3:
		print(-1)
	else:
		for i in range(1, n + 1):
			q = [[i, [i]]]
			while q:
				e = q.pop()
				if len(e[1]) == n:
					print(*e[1])
					found = True
					break
				for j in range(e[0] - 4, e[0] - 1):
					if j > 0 and j not in e[1]:
						q.append([j, e[1] + [j]])
				for j in range(e[0] + 2, e[0] + 5):
					if j <= n and j not in e[1]:
						q.append([j, e[1] + [j]])
			if found:
				break
		if not found:
			print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	cnt = int(n / 2) - 2
	N = n
	if n % 2 == 0:
		N -= 1
	while N > 0:
		print(N, end=' ')
		N -= 2
	print('4 2', end=' ')
	k = 6
	while cnt > 0:
		print(k, end=' ')
		k += 2
		cnt -= 1
	print()


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		a = []
		current = n
		while current > 4:
			a.append(current)
			current -= 2
		if current == 4:
			a.append(2)
			a.append(4)
			a.append(1)
			a.append(3)
			current = 5
		else:
			a.append(3)
			a.append(1)
			a.append(4)
			a.append(2)
			current = 6
		while current < n:
			a.append(current)
			current += 2
		for i in a:
			print(i)


def solve(n):
	if n <= 3:
		return False
	arr = list()
	i = n if n & 1 else n - 1
	while i >= 1:
		arr.append(i)
		i -= 2
	arr.append(4)
	arr.append(2)
	i = 6
	while i <= n:
		arr.append(i)
		i += 2
	return (True, arr)
for _ in range(int(input())):
	n = int(input())
	ans = solve(n)
	if not ans:
		print(-1)
	else:
		print(*ans[1])


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	arr = [str(x) for x in range(n, 0, -1) if x & 1 == 1]
	arr.extend(['4', '2'])
	arr.extend([str(x) for x in range(6, n + 1) if x & 1 == 0])
	print(' '.join(arr))


t = int(input())
for T in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		f = [y for y in range(2, n + 1, 4)]
		m = [z for z in range(4, n + 1, 4)]
		s = [x for x in range(1, n + 1, 2)]
		ans = f + m[::-1] + s
		print(*ans)


T = int(input())
from collections import deque
for _ in range(T):
	N = int(input())
	if N < 4:
		print(-1)
		continue
	q = deque([3, 1, 4, 2])
	for i in range(5, N + 1):
		if i % 2:
			q.append(i)
		else:
			q.appendleft(i)
	print(*q)


def arr(n):
	l = []
	e = 2
	o = 1
	c = 0
	while c < n:
		i = 0
		while e <= n and i < 2:
			l.append(e)
			e += 2
			i += 1
			c += 1
		j = 0
		while o <= n and j < 2:
			l.append(o)
			o += 2
			j += 1
			c += 1
	return l
t = int(input())
for w in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n % 4 == 0 or (n + 3) % 4 == 0:
		print(*arr(n))
	elif n % 2 == 0:
		arr1 = arr(n)
		(arr1[n - 1], arr1[n - 3]) = (arr1[n - 3], arr1[n - 1])
		(arr1[n - 1], arr1[n - 2]) = (arr1[n - 2], arr1[n - 1])
		print(*arr1)
	else:
		arr1 = arr(n)
		arr2 = arr1[0:n - 6]
		arr2.append(arr1[n - 3])
		arr2 = arr2 + arr1[n - 6:n - 3]
		arr2 = arr2 + arr1[n - 2:]
		print(*arr2)


t = int(input())
for we in range(t):
	n = int(input())
	l = [str(1)]
	if n <= 3:
		print('-1')
	elif n == 4:
		print('2 4 1 3')
	elif n == 6:
		print('1 3 5 2 6 4')
	elif n == 5:
		print('1 3 5 2 4')
	else:
		if n % 2 == 0:
			k = 1
			while k < n - 2:
				k += 2
				l.append(str(k))
			k -= 3
			l.append(str(k))
			k += 4
			l.append(str(k))
			k -= 2
			l.append(str(k))
			k -= 4
			l.append(str(k))
			while k > 3:
				k -= 2
				l.append(str(k))
		else:
			k = 1
			while k < n - 1:
				k += 2
				l.append(str(k))
			k -= 3
			l.append(str(k))
			k += 2
			l.append(str(k))
			k -= 4
			l.append(str(k))
			while k > 3:
				k -= 2
				l.append(str(k))
		print(' '.join(l))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		if n % 2 == 0:
			ans = []
			k = n - 1
			while k >= 1:
				ans.append(k)
				k -= 2
			ans.append(4)
			ans.append(2)
			k = 6
			while k <= n:
				ans.append(k)
				k += 2
		else:
			ans = []
			k = n
			while k >= 1:
				ans.append(k)
				k -= 2
			ans.append(4)
			ans.append(2)
			k = 6
			while k <= n - 1:
				ans.append(k)
				k += 2
		print(*ans)


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
A = []
B = []
for i in range(1, 1001):
	if i % 2 == 0:
		A.append(i)
	else:
		B.append(i)
(A[0], A[1]) = (A[1], A[0])
for _ in range(int(input())):
	N = int(input())
	if N < 4:
		print(-1)
	else:
		x = A[:N // 2]
		y = B[:math.ceil(N / 2)]
		print(*y[::-1] + x)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(i)
	ans = ans[::-1]
	ans.append(4)
	ans.append(2)
	for i in range(6, n + 1, 2):
		ans.append(i)
	print(' '.join(map(str, ans)))


def solve():
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		sol = []
		i = 1
		while i <= n:
			sol.append(i)
			i += 2
		i = sol[-1]
		val = i - 3
		i += -1 if i == n else 1
		sol.append(val)
		while i > 0:
			if i != val:
				sol.append(i)
			i -= 2
		print(' '.join(map(str, sol)))
		for i in range(n - 1):
			if sol[i] > n:
				raise ValueError('Value out of range')
			diff = abs(sol[i] - sol[i + 1])
			if diff > 4 or diff < 2:
				raise ValueError(f'diff={diff}, sol[{i}]={sol[i]} + sol[{i + 1}]={sol[i + 1]}')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	if n < 4:
		print('-1')
	else:
		odd = list(range(5, n + 1, 2))
		odd.reverse()
		even = list(range(6, n + 1, 2))
		r = odd + [3, 1, 4, 2] + even
		print(' '.join(map(str, r)))
testcase(int(inp()))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		if n < 4:
			print(-1)
			continue
		if n == 4:
			print('2 4 1 3')
		if n == 5:
			print('2 4 1 3 5')
		if n == 6:
			print('6 2 4 1 3 5')
		if n >= 7:
			a = deque([6, 2, 4, 1, 3, 5])
			z = 0
			i = 7
			while i <= n:
				if i - 2 == a[-1]:
					a.append(i)
				else:
					a.appendleft(i)
				i += 1
			print(*a)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import math
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		a = []
		if n % 2 == 0:
			for i in range(1, n // 2 + 1):
				a.append(2 * i)
			a.append(n - 3)
			a.append(n - 1)
			for i in range(1, n // 2 - 1):
				a.append(n - 3 - 2 * i)
		else:
			for i in range(math.ceil(n / 2)):
				a.append(2 * i + 1)
			a.append(n - 3)
			a.append(n - 1)
			for i in range(1, n // 2 - 1):
				a.append(n - 3 - 2 * i)
		print(*a)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	for i in range(n, 0, -1):
		if i & 1 == 1:
			print(i, end=' ')
	print('4 2', end=' ')
	for i in range(6, n + 1):
		if i & 1 == 0:
			print(i, end=' ')
	print('\n')


from sys import stdin, stdout
import collections
t = int(input())

def solve(n):
	(odd, even) = ([], [])
	if n == 2 or n == 3:
		print(-1)
		return
	for i in range(1, n + 1):
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	odd = odd[::-1]
	(even[0], even[1]) = (even[1], even[0])
	res = odd + even
	ok = True
	for i in range(1, len(res)):
		diff = abs(res[i] - res[i - 1])
		if diff > 4 or diff < 2:
			ok = False
			break
	if not ok:
		print(-1)
		return
	print(' '.join(list(map(str, res))))
for i in range(t):
	n = int(input())
	solve(n)


for i in range(int(input())):
	n = int(input())
	lst = list()
	lst1 = list()
	for i in range(1, n + 1):
		if i % 2 == 0:
			lst.append(i)
		else:
			lst1.append(i)
	if n % 2 == 0:
		c = lst[-1] - 3
		if c in lst1:
			lst.append(c)
			lst1.remove(c)
			print(*lst, sep=' ', end=' ')
			lst1.sort(reverse=True)
			print(*lst1, sep=' ')
		else:
			print(-1)
	else:
		c = lst1[-1] - 3
		if c in lst:
			lst1.append(c)
			lst.remove(c)
			print(*lst1, sep=' ', end=' ')
			lst.sort(reverse=True)
			print(*lst, sep=' ')
		else:
			print(-1)


for t in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		if n % 4 == 0:
			print('2 4 1 3', end='')
		elif n % 4 == 1:
			print('1 3 5 2 4', end='')
		elif n % 4 == 2:
			print('1 3 5 2 4 6', end='')
		elif n % 4 == 3:
			print('2 5 1 4 6 3 7', end='')
		for s in range(4 + n % 4, n, 4):
			print(' {} {} {} {}'.format(s + 2, s + 4, s + 1, s + 3), end='')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		a = [3, 1, 4, 2]
		if n == 4:
			print(*a)
		else:
			j = 6
			c = []
			while j <= n:
				c.append(j)
				j += 2
			j = 5
			d = []
			while j <= n:
				d.append(j)
				j += 2
			d.reverse()
			f = d + a + c
			print(*f)


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
import threading
import bisect
for t in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	if n == 4:
		print(3, 1, 4, 2)
		continue
	arr = [0] * n
	isFist = True
	l = 0
	r = n - 1
	for i in range(n, 0, -1):
		if isFist == True:
			arr[l] = i
			l += 1
			isFist = False
		else:
			arr[r] = i
			r -= 1
			isFist = True
	if n % 2 == 0:
		c = n // 2 - 1
		c1 = c - 1
		(arr[c], arr[c1]) = (arr[c1], arr[c])
	else:
		c = n // 2 + 1
		c1 = c - 2
		(arr[c], arr[c1]) = (arr[c1], arr[c])
		(arr[c], arr[c + 1]) = (arr[c + 1], arr[c])
		(arr[c], arr[c - 1]) = (arr[c - 1], arr[c])
	for i in range(len(arr)):
		print(arr[i], end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		res = []
		res.extend([2, 4, 1, 3])
		n -= 4
		(t1, t2) = (5, 0)
		while n > 0:
			if t2 == 0:
				res.insert(0, t1)
			else:
				res.append(t1)
			t1 += 1
			t2 = t2 ^ 1
			n -= 1
		print(*res)


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(-1)
	elif n == 3:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		x1 = n - 5 + 1
		x2 = x1 + 3
		x3 = x2 - 2
		x4 = x3 + 3
		x5 = x4 - 2
		ans1 = [x1]
		ans2 = [x2, x3, x4]
		ans3 = [x5]
		x5 -= 3
		x1 -= 2
		while True:
			if x1 <= 0:
				break
			else:
				ans1.append(x1)
				x1 -= 2
		ans1.reverse()
		while True:
			if x5 <= 0:
				break
			else:
				ans3.append(x5)
				x5 -= 2
		print(*ans1, *ans2, *ans3)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	a = [1]
	x = 2
	fl = 1
	while x <= n:
		if fl == 1:
			a += [x]
			x += 1
			fl = -1
		else:
			a = [x] + a
			x += 1
			fl = 1
	for x in a:
		if x == 2 or x == 4:
			print(6 - x, end=' ')
		else:
			print(x, end=' ')
	print()


from sys import stdin, stdout
t = int(stdin.readline().strip())
p = [[3, 1, 5, 2, 4], [3, 1, 5, 2, 4, 6], [3, 1, 5, 2, 6, 4, 7], [3, 1, 5, 2, 6, 8, 4, 7], [3, 1, 5, 2, 6, 8, 4, 7, 9]]
for _ in range(t):
	n = int(stdin.readline().strip())
	a = 0
	A = []
	if n <= 3:
		stdout.write('-1\n')
		continue
	if n == 4:
		stdout.write('3 1 4 2\n')
		continue
	for _ in range(n // 5 - 1):
		for d in p[0]:
			A.append(str(a + d))
		a += 5
	for d in p[n % 5]:
		A.append(str(a + d))
	stdout.write(' '.join(A) + '\n')


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(ntc):
		n = next(ints)
		if n == 1:
			ans = [1]
		elif n <= 3:
			ans = [-1]
		elif n <= 4:
			ans = [2, 4, 1, 3]
		elif n <= 5:
			ans = [1, 4, 2, 5, 3]
		else:
			ans = []
			x = 1 + n % 2
			while x < n - 5:
				ans.append(x)
				x += 2
			ans.extend([n - 5, n - 2, n, n - 3, n - 1, n - 4])
			x = n - 6
			while x > 0:
				ans.append(x)
				x -= 2
		print(' '.join(map(str, ans)))
	return
main()


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	n = INT()
	l = []
	if n % 2 == 0:
		for i in range(n - 1, 0, -2):
			l.append(i)
		l.append(4)
		l.append(2)
		for i in range(6, n + 1, 2):
			l.append(i)
	else:
		for i in range(n, 0, -2):
			l.append(i)
		l.append(4)
		l.append(2)
		for i in range(6, n + 1, 2):
			l.append(i)
	if n == 1 or n == 2 or n == 3:
		print(-1)
	else:
		print(*l)
	t -= 1


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	maxOdd = n - int(not n % 2)
	even = 6
	maxEven = n - n % 2
	ans = []
	if n < 4:
		print(-1)
	else:
		while True:
			ans.append(maxOdd)
			maxOdd -= 2
			if maxOdd < 1:
				break
		ans.extend([4, 2])
		while True:
			if maxEven < even:
				break
			ans.append(even)
			even += 2
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 5:
		print(1, 3, 5, 2, 4)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		l = []
		for i in range((n + 1) // 2):
			print(2 * i + 1, end=' ')
			l.append(2 * i + 2)
		k = len(l)
		if n % 2 == 0:
			print(l[-3], l[-1], l[-2], end=' ')
			l.pop()
			l.pop()
			l.pop()
		else:
			l.pop()
			print(l[-2], l[-1], l[-3], end=' ')
			l.pop()
			l.pop()
			l.pop()
			k -= 1
		k -= 3
		for i in range(k - 1, -1, -1):
			print(l[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	lis = []
	if n == 2 or n == 3:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		for i in range(1, n + 1, 2):
			lis.append(i)
		if n % 2 == 0:
			lis.append(n - 4)
			lis.append(n)
			lis.append(n - 2)
			for j in range(n - 6, 0, -2):
				if j <= 0:
					break
				lis.append(j)
		else:
			lis.append(n - 3)
			lis.append(n - 1)
			for j in range(n - 5, 0, -2):
				if j <= 0:
					break
				lis.append(j)
		print(*lis)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print('-1')
	else:
		(odd, even) = ([], [])
		i = 1
		while i <= n:
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
			i += 1
		if n == 4:
			print('3 1 4 2')
		elif n <= 5:
			print(*odd, *even, sep=' ')
		else:
			l = []
			if abs(even[-2] - odd[-1]) <= 4 and abs(even[-2] - odd[-1]) >= 2:
				x = even[-2]
				even.remove(x)
				l.append(x)
				l.append(even[-1])
				even.remove(even[-1])
			else:
				x = even[-3]
				even.remove(x)
				l.append(x)
				l.append(even[-1])
				even.remove(even[-1])
			even.sort(reverse=True)
			print(*odd, *l, *even, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
		continue
	arrOdd = [i for i in range(1, n + 1) if i % 2 == 1]
	arrEven = [i for i in range(1, n + 1) if i % 2 == 0 and i not in [4, 2]]
	arrOdd = arrOdd[::-1]
	res = arrOdd + [4, 2] + arrEven
	print(*res)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		ans = []
		if n == 4:
			ans = [3, 1, 4, 2]
		elif n % 2 == 1:
			for k in range(1 + n // 2):
				ans.append(n - k * 2)
			ans.append(4)
			ans.append(2)
			for k in range(n // 2 - 2):
				ans.append(6 + k * 2)
		else:
			for k in range(n // 2):
				ans.append(n - k * 2)
			ans.append(5)
			for k in range(n // 2):
				if k != 2:
					ans.append(1 + k * 2)
		print(*ans)


mod = int(1000000000.0) + 7

def ip():
	return int(input())

def Ip():
	return map(int, input().split())
for _ in range(0, int(input())):
	n = int(input())
	if n < 6:
		if n < 4:
			print(-1)
		elif n == 4:
			print('2 4 1 3')
		else:
			print('1 3 5 2 4')
	else:
		i = 1
		while i <= n:
			print(i, end=' ')
			i += 2
		i -= 5
		p = i
		print(i, end=' ')
		if i + 4 <= n:
			i += 4
		else:
			i += 2
		print(i, end=' ')
		i -= 2
		while i > 0:
			if i != p:
				print(i, end=' ')
			i -= 2
		print()


def solve(n):
	if n < 4:
		print(-1)
		return
	if n == 4:
		print('3 1 4 2')
		return
	res = []
	for x in range(1, n + 1, 2):
		res.append(x)
	res.append(x - 3)
	if n % 2 == 1:
		res.append(n - 1)
		for x in range(n - 5, 0, -2):
			res.append(x)
	else:
		res.append(n)
		res.append(n - 2)
		for x in range(n - 6, 0, -2):
			res.append(x)
	for i in res:
		print(i, end=' ')
	print()
t = int(input())
for x in range(t):
	n = int(input())
	solve(n)


for q in range(int(input())):
	n = int(input())
	if n <= 3:
		print('-1')
	else:
		res = []
		ans = []
		for i in range(1, n + 1, 2):
			res.append(i)
		for i in range(2, n + 1, 2):
			ans.append(i)
		(ans[0], ans[1]) = (ans[1], ans[0])
		print(*res[::-1], *ans)


for _ in range(int(input())):
	n = int(input())
	l = []
	(x, y) = (0, 0)
	if n > 3:
		if n % 2 == 0:
			for i in range(1, n, 2):
				l.append(i)
			x = l.pop()
			y = l.pop()
			l.append(x)
			l.append(y)
			for i in range(n, 0, -2):
				l.append(i)
			print(*l)
		else:
			for j in range(2, n, 2):
				l.append(j)
			x = l.pop()
			y = l.pop()
			l.append(x)
			l.append(y)
			for j in range(n, 0, -2):
				l.append(j)
			print(*l)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	x1 = []
	for i in range(1, n + 1, 4):
		x1.append(i)
	x2 = []
	for i in range(2, n + 1, 4):
		x2.append(i)
	x3 = []
	for i in range(3, n + 1, 4):
		x3.append(i)
	x4 = []
	for i in range(4, n + 1, 4):
		x4.append(i)
	x = x3 + x1[::-1] + x4 + x2[::-1]
	for i in range(1, n):
		if not 2 <= abs(x[i] - x[i - 1]) <= 4:
			print(-1)
			break
	else:
		print(*x)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(1)
		continue
	elif n == 2 or n == 3:
		print(-1)
		continue
	l = []
	for j in range(2, n + 1, 2):
		l.append(j)
	if n % 2 == 0:
		l.append(n - 3)
		l.append(n - 1)
		for j in range(n - 5, 0, -2):
			l.append(j)
		print(' '.join(map(str, l)))
	else:
		l.append(n - 4)
		l.append(n)
		l.append(n - 2)
		for j in range(n - 6, 0, -2):
			l.append(j)
		print(' '.join(map(str, l)))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def main():
	for _ in range(ii()):
		n = ii()
		if n <= 3:
			print(-1)
			continue
		for i in range(n, 0, -1):
			if i % 2:
				print(i, end=' ')
		print(4, 2, end=' ')
		for i in range(6, n + 1):
			if i % 2 == 0:
				print(i, end=' ')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	ans = []
	count = 0
	if n < 4:
		print(-1)
		continue
	p = n % 4
	n = n - p
	for i in range(1, n + 1, 4):
		temp = [i + 2, i, i + 3, i + 1]
		count += 1
		ans = temp + ans
	if p == 0:
		for i in ans:
			print(i, end=' ')
		print()
	if p == 1:
		print(n + 1, end=' ')
		for i in range(len(ans)):
			print(ans[i], end=' ')
		print()
	if p == 2:
		x = 1
		print(n + 2, end=' ')
		for i in range(x):
			print(ans[i], end=' ')
		print(str(n + 1), end=' ')
		for i in range(x, len(ans)):
			print(ans[i], end=' ')
		print()
	if p == 3:
		x = 3
		print(n + 3, end=' ')
		print(n + 1, end=' ')
		for i in range(x):
			print(ans[i], end=' ')
		print(str(n + 2), end=' ')
		for i in range(x, len(ans)):
			print(ans[i], end=' ')
		print()


def solve():
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	elif n % 2 == 0:
		perm = list(range(2, n + 1, 2))
		perm.append(n - 3)
		perm.append(n - 1)
		perm.extend(list(range(n - 5, 0, -2)))
		print(*perm)
	else:
		perm = list(range(1, n + 1, 2))
		perm.append(n - 3)
		perm.append(n - 1)
		perm.extend(range(n - 5, 0, -2))
		print(*perm)

def main():
	cases()

def cases():
	for _ in range(int(input())):
		solve()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	if n < 4:
		print('-1')
	else:
		if n % 2 == 0:
			b = n - 1
		else:
			b = n
		for i in range(b, 0, -2):
			a.append(i)
		a.append(4)
		a.append(2)
		if n >= 6:
			even = 6
			for i in range(even, n + 1, 2):
				a.append(i)
		print(*a, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	if n >= 4:
		ans = []
		if n % 4 == 0:
			for i in range(1, n + 1, 4):
				ans += [i + 1, i + 3, i, i + 2]
		else:
			d = n // 4 - 1
			cur = 1
			for i in range(d):
				ans += [cur + 1, cur + 3, cur, cur + 2]
				cur += 4
			if n % 4 == 1:
				ans += [cur + 1, cur + 3, cur, cur + 2, cur + 4]
			elif n % 4 == 2:
				ans += [cur, cur + 2, cur + 4, cur + 1, cur + 3, cur + 5]
			else:
				ans += [cur, cur + 3, cur + 1, cur + 5, cur + 2, cur + 4, cur + 6]
		print(*ans)


t = int(input())
while t > 0:
	n = int(input())
	if n < 4:
		print(-1)
		t -= 1
		continue
	ans = []
	for x in range(n // 4):
		ans += [4 * x + 2, 4 * x + 4, 4 * x + 1, 4 * x + 3]
	if n % 4 == 1:
		ans += [n]
	elif n % 4 == 2:
		ans = ans[0:-1] + [n - 1] + [ans[-1]] + [n]
	elif n % 4 == 3:
		ans = ans[0:-1] + [n - 2] + [n] + [ans[-1]] + [n - 1]
	print(*ans)
	t -= 1


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return list(map(str, input().strip()))

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby
from itertools import permutations as comb

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
t = I()
for _ in range(t):
	n = I()
	l = []
	if n == 1:
		print(1)
	elif n < 4:
		print(-1)
	else:
		if n % 2 == 0:
			for i in range(1, n + 1, 2):
				l.append(i)
			(l[-1], l[-2]) = (l[-2], l[-1])
			for i in range(n, 0, -2):
				l.append(i)
		else:
			for i in range(2, n + 1, 2):
				l.append(i)
			(l[-1], l[-2]) = (l[-2], l[-1])
			for i in range(n, 0, -2):
				l.append(i)
		print(*l)


t = int(input())
for i in range(0, t):
	N = int(input())
	if N < 4:
		print(-1)
	elif N >= 4:
		list_even = []
		list_odd = []
		for i in range(0, N + 1):
			if i == 0:
				continue
			elif i % 2 == 0:
				list_even.append(i)
			else:
				list_odd.append(i)
		list_odd.reverse()
		list_even[0] = 4
		list_even[1] = 2
		ans = list_odd + list_even
		print(*ans)


def f(x):
	g = []
	d = []
	for i in range(1, x + 1):
		if i % 2:
			d.append(i)
		else:
			g.append(i)
	g = g[::-1]
	if x % 2:
		(g[0], g[1]) = (g[1], g[0])
	else:
		(g[1], g[2]) = (g[2], g[1])
		(g[0], g[1]) = (g[1], g[0])
	return d + g
for i in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	elif n == 6:
		print(5, 3, 6, 2, 4, 1)
	else:
		print(*f(n))


t = int(input())
for _ in range(t):
	out = []
	works = True
	n = int(input())
	while n:
		if n == 1:
			out.append(1)
			break
		elif n == 2:
			works = False
			break
		elif n == 3:
			works = False
			break
		elif n == 4:
			out += [3, 1, 4, 2]
			break
		elif n == 5:
			out += [5, 2, 4, 1, 3]
			break
		elif n == 7:
			out += [7, 4, 2, 6, 3, 1, 5]
			break
		elif n == 8:
			out += [8, 4, 7, 3, 6, 2, 5, 1]
			break
		elif n == 9:
			out += [9, 7, 4, 2, 6, 8, 5, 1, 3]
			break
		else:
			out.append(n)
			out.append(n - 3)
			out.append(n - 1)
			out.append(n - 4)
			out.append(n - 2)
			n -= 5
	if works:
		print(*out)
	else:
		print(-1)


t = int(input())
while t:
	a2 = [2, 5, 1, 4, 6, 3]
	a1 = [2, 4, 1, 3, 5]
	a3 = [3, 7, 5, 1, 4, 6, 2]
	a0 = [2, 4, 1, 3]
	n = int(input())
	if n <= 3:
		print(-1)
		t -= 1
		continue
	diff = [3, 2, -3, 2]
	ans = []
	s = -1
	a = n % 4
	n = n - a - 4
	cur = 0
	while cur < n:
		s += diff[cur % 4]
		ans.append(s)
		cur += 1
	if a == 1:
		a1 = [x + n for x in a1]
		ans.extend(a1)
	elif a == 2:
		a2 = [x + n for x in a2]
		ans.extend(a2)
	elif a == 3:
		a3 = [x + n for x in a3]
		ans.extend(a3)
	else:
		a0 = [x + n for x in a0]
		ans.extend(a0)
	print(' '.join(map(str, ans)))
	t -= 1


for test in range(int(input())):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		r = []
		for i in range(n // 4 - 1):
			r.append(4 * i + 2)
			r.append(4 * i + 4)
			r.append(4 * i + 1)
			r.append(4 * i + 3)
		i = n // 4 - 1
		if n % 4 == 0:
			r.append(4 * i + 2)
			r.append(4 * i + 4)
			r.append(4 * i + 1)
			r.append(4 * i + 3)
		elif n % 4 == 1:
			r.append(4 * i + 2)
			r.append(4 * i + 4)
			r.append(4 * i + 1)
			r.append(4 * i + 3)
			r.append(4 * i + 5)
		elif n % 4 == 2:
			r.append(4 * i + 2)
			r.append(4 * i + 6)
			r.append(4 * i + 4)
			r.append(4 * i + 1)
			r.append(4 * i + 3)
			r.append(4 * i + 5)
		elif n % 4 == 3:
			r.append(4 * i + 2)
			r.append(4 * i + 6)
			r.append(4 * i + 4)
			r.append(4 * i + 1)
			r.append(4 * i + 3)
			r.append(4 * i + 5)
			r.append(4 * i + 7)
		print(' '.join(map(str, r)))


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	l1 = []
	for i in range(1, n + 1):
		if i % 2 != 0:
			l1.append(i)
	l1.sort(reverse=True)
	l1.append(4)
	l1.append(2)
	for i in range(6, n + 1):
		if i % 2 == 0:
			l.append(i)
	if n < 4:
		print('-1')
	else:
		print(*l1, *l)


def f():
	n = int(input())
	for _ in range(n):
		p = int(input())
		if p < 4:
			print(-1)
		elif p == 4:
			print(3, 1, 4, 2)
		elif p == 5:
			print(1, 3, 5, 2, 4)
		else:
			for i in range(1, p + 1, 2):
				print(i, end=' ')
			if p % 2 == 0:
				print(p - 4, end=' ')
				print(p, p - 2, end=' ')
				for i in range(p - 6, 1, -2):
					print(i, end=' ')
				print('')
			else:
				print(p - 3, end=' ')
				print(p - 1, p - 5, end=' ')
				for i in range(p - 7, 1, -2):
					print(i, end=' ')
				print('')
f()


for _ in range(int(input())):
	n = int(input())
	l = []
	if n > 3:
		if n % 2 == 1:
			a = n // 2 + 1
			c = 2
		else:
			a = n // 2
			c = 1
		l = []
		k = n
		for i in range(n):
			if i < a:
				l.append(k)
				k -= 2
			elif i == a:
				l.append(c)
			else:
				c += 2
				l.append(c)
		for i in range(n):
			if l[i] == 2:
				l[i] = 4
			elif l[i] == 4:
				l[i] = 2
		print(*l)
	else:
		print(-1)


from math import *
t = int(input())
while t > 0:
	n = int(input())
	if n // 4 == 0:
		print(-1)
	elif n % 4 == 0:
		a = [2, 4, 1, 3]
		for i in range(n):
			print(a[i % 4], end=' ')
			a[i % 4] += 4
		print()
	elif n % 4 == 1:
		a = [2, 4, 1, 3]
		for i in range(n - 1):
			print(a[i % 4], end=' ')
			a[i % 4] += 4
		print(n)
	elif n % 4 == 2:
		a = [2, 4, 1, 3]
		for i in range(n - 6):
			print(a[i % 4], end=' ')
			a[i % 4] += 4
		print(n - 5, a[0] + 1, a[1] + 1, a[2] + 1, a[3] + 1, n)
	else:
		a = [2, 4, 1, 3]
		for i in range(n - 7):
			print(a[i % 4], end=' ')
			a[i % 4] += 4
		l = 4 * (n // 4 - 1)
		print(1 + l, 3 + l, 6 + l, 2 + l, 4 + l, 7 + l, 5 + l)
	t -= 1


def solve(l, r):
	n = r - l + 1
	if n == 0:
		return []
	elif n % 4 == 0:
		return [l + 1, l + 3, l, l + 2] + solve(l + 4, r)
	elif n % 4 == 1:
		return [l] + solve(l + 1, r)
	elif n % 4 == 2:
		return [l] + solve(l + 1, r - 1) + [r]
	return [5, 1, 3, 6, 2, 4, 7] + solve(l + 7, r)
t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		print(*solve(1, n))


def solve(n):
	if n <= 3:
		print(-1)
		return
	for i in range(0, n // 4 - 1):
		print(i * 4 + 2, end=' ')
		print(i * 4 + 4, end=' ')
		print(i * 4 + 1, end=' ')
		print(i * 4 + 3, end=' ')
	i = n // 4 - 1
	if n % 4 == 0:
		print(i * 4 + 2, end=' ')
		print(i * 4 + 4, end=' ')
		print(i * 4 + 1, end=' ')
		print(i * 4 + 3, end=' ')
	elif n % 4 == 1:
		print(i * 4 + 2, end=' ')
		print(i * 4 + 4, end=' ')
		print(i * 4 + 1, end=' ')
		print(i * 4 + 3, end=' ')
		print(i * 4 + 5, end=' ')
	elif n % 4 == 2:
		print(i * 4 + 2, end=' ')
		print(i * 4 + 4, end=' ')
		print(i * 4 + 6, end=' ')
		print(i * 4 + 3, end=' ')
		print(i * 4 + 1, end=' ')
		print(i * 4 + 5, end=' ')
	elif n % 4 == 3:
		print(i * 4 + 2, end=' ')
		print(i * 4 + 4, end=' ')
		print(i * 4 + 6, end=' ')
		print(i * 4 + 3, end=' ')
		print(i * 4 + 1, end=' ')
		print(i * 4 + 5, end=' ')
		print(i * 4 + 7, end=' ')
	print()

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		solve(n)
	return 0
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
	else:
		base = [3, 1, 4, 2]
		for i in range(n - 4):
			if i % 2 == 0:
				base.insert(0, 4 + i + 1)
			else:
				base.append(4 + i + 1)
		print(' '.join(map(str, base)))


for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print('-1')
		continue
	r = [1, 3]
	l = [4, 2]
	for i in range(5, n + 1):
		if i % 2:
			r.append(i)
		else:
			l.append(i)
	l.reverse()
	print(*l + r)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		num = int(input())
		if num <= 3:
			yield (-1)
		else:
			ans = list(map(lambda x: x * 2, range(1, num // 2 + 1)))
			ans.append(num // 2 * 2 - 3)
			for i in range(num // 2 + num % 2, 0, -1):
				if i * 2 - 1 != num // 2 * 2 - 3:
					ans.append(i * 2 - 1)
			yield ' '.join((str(x) for x in ans))
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	while n >= 10:
		print(n, n - 3, n - 1, n - 4, n - 2, end=' ')
		n -= 5
	if n == 4:
		print(3, 1, 4, 2)
	if n == 5:
		print(5, 2, 4, 1, 3)
	if n == 6:
		print(5, 3, 6, 2, 4, 1)
	if n == 7:
		print(7, 4, 2, 6, 3, 1, 5)
	if n == 8:
		print(7, 5, 8, 6, 3, 1, 4, 2)
	if n == 9:
		print(9, 6, 8, 5, 7, 3, 1, 4, 2)


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		l = int(stdin.readline())
		if l < 4:
			stdout.write(str(-1) + '\n')
			continue
		max_odd = l if l & 1 else l - 1
		ans = [number for number in range(max_odd, 0, -2)]
		ans.append(4)
		ans.append(2)
		for i in range(6, l + 1, 2):
			ans.append(i)
		stdout.write(' '.join(map(str, ans)) + '\n')
main()


for k in range(int(input())):
	x = int(input())
	if x < 4:
		print(-1)
		continue
	for n in range(x, 0, -1):
		if n % 2 == 1:
			print(n, end=' ')
	print(4, 2, end=' ')
	for n in range(6, x + 1, 2):
		print(n, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		even = []
		odd = []
		for x in range(1, n + 1):
			if x % 2 == 0:
				even.append(x)
			else:
				odd.append(x)
		if n != 4:
			odd.reverse()
			(even[-1], even[-2]) = (even[-2], even[-1])
			if n % 2 == 0:
				pass
				(odd[0], odd[1], odd[2]) = (odd[2], odd[0], odd[1])
		res = even + odd
		print(*res)


t = int(input())
for tt in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	if n == 4:
		print('3 1 4 2')
		continue
	ans = []
	for i in range(1, n + 1, 2):
		ans.append(i)
	last = ans[-1] - 3
	ans.append(last)
	if ans[-1] + 4 == n:
		ans.append(n)
		ans.append(n - 2)
	else:
		ans.append(ans[-1] + 2)
	for i in reversed(range(2, last, 2)):
		ans.append(i)
	print(' '.join(map(str, ans)))


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	ans = []
	if n <= 3:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	else:
		ans = []
		if n % 2 != 0:
			for i in range(n, 0, -2):
				ans.append(i)
			for i in range(2, n, 2):
				ans.append(i)
			x = ans.index(2)
			y = ans.index(4)
			(ans[x], ans[y]) = (ans[y], ans[x])
		else:
			for i in range(n - 1, 0, -2):
				ans.append(i)
			for i in range(2, n + 1, 2):
				ans.append(i)
			x = ans.index(2)
			y = ans.index(4)
			(ans[x], ans[y]) = (ans[y], ans[x])
		print(*ans)


def permut(n):
	if n <= 3:
		print(-1)
		return
	l = [3, 1, 4, 2]
	for i in range(5, n + 1):
		if i % 2 != 0:
			l.append(i)
		else:
			l = [i] + l
	for i in l:
		print(i, end=' ')
	print()
T = int(input())
for i in range(T):
	n = int(input())
	permut(n)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def rec(a, n, was):
	if n == len(a):
		print(True)
		return True
	v = a[n - 1]
	for i in [v + 2, v - 4, v + 3, v - 3, v + 4, v - 2]:
		if i < 1 or i > len(a):
			continue
		if abs(i - v) > 1 and (not was[i]):
			a[n] = i
			was[i] = 1
			if rec(a, n + 1, was):
				return True
			was[i] = 0
			a[n] = 0
	return False

def solve_stupid():
	n = mint()
	ok = False
	for i in range(1, n + 1):
		x = [i] * n
		was = [0] * (n + 1)
		was[i] = 1
		if rec(x, 1, was):
			ok = True
			break
	if ok:
		print('YES')
		print(x)
	else:
		print('NO')

def solve():
	n = mint()
	if n < 4:
		print(-1)
		return
	a = []
	for i in range(1, n + 1, 2):
		a.append(i)
	x = a[-1]
	a.append(x - 3)
	if n % 2:
		a.append(x - 1)
	else:
		a.append(x + 1)
		a.append(x - 1)
	for i in range(x - 5, 0, -2):
		a.append(i)
	if n == 4:
		a = [2, 4, 1, 3]
	print(*a)
for i in range(mint()):
	solve()


import sys
import math
from collections import deque
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
		continue
	else:
		base = '2 4 1 3'
		for i in range(5, n + 1):
			if i % 2 == 0:
				base = base + ' ' + str(i)
			else:
				base = str(i) + ' ' + base
		print(base)


def permutations(num: int):
	if num < 4:
		return '-1'
	if num == 4:
		return '3 1 4 2'
	else:
		even = list()
		odd = list()
		for i in range(1, num + 1, 2):
			odd.append(i)
		for i in range(2, num + 1, 2):
			even.append(i)
		even.reverse()
		if num % 2 == 0:
			(even[1], even[2]) = (even[2], even[1])
		(even[0], even[1]) = (even[1], even[0])
		return ' '.join(map(str, odd + even))
quant = int(input())
inputs = list()
for i in range(quant):
	inputs.append(int(input()))
for i in inputs:
	print(permutations(i))


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print('-1')
		continue
	if n % 2 == 0:
		A = []
		for i in range(2, n + 1, 2):
			A.append(i)
		A.append(A[-1] - 3)
		for i in range(n - 1, 0, -2):
			if i in A:
				continue
			A.append(i)
		print(*A)
	if n % 2 != 0:
		A = []
		for i in range(2, n, 2):
			A.append(i)
		A.append(A[-1] - 3)
		for i in range(n, 0, -2):
			if i in A:
				continue
			A.append(i)
		print(*A)


import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)
from collections import deque

def slv(N):
	if N <= 3:
		return [-1]
	ans = deque([N - 2, N, N - 3])
	rem = set(range(1, N + 1)) - set(ans)
	t = True
	for n in sorted(rem, reverse=True):
		if t:
			ans.append(n)
		else:
			ans.appendleft(n)
		t = not t
	return list(ans)

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		print(*slv(N))
main()


import random
import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
for q in range(t):
	n = II()
	if n in [2, 3]:
		print(-1)
	else:
		a = []
		b = []
		for i in range(n):
			if i % 2 == 0:
				a.append(i + 1)
			else:
				b.append(i + 1)
		a += b[:][::-1]
		if n % 2 == 0:
			(a[n // 2 - 1], a[n // 2 - 2]) = (a[n // 2 - 2], a[n // 2 - 1])
		else:
			(a[n // 2 + 1], a[n // 2 + 2]) = (a[n // 2 + 2], a[n // 2 + 1])
		print(*a)


import sys
sys.setrecursionlimit(1000000000)
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	res = [n for n in range(1, n + 1, 2)]
	evens = [n for n in range(2, n + 1, 2)]
	res = evens[2:][::-1] + evens[:2] + res
	print(' '.join(map(str, res)))


def main():
	n = int(input())
	if n < 4:
		print(-1)
		return
	if n % 2 == 0:
		end = n - 1
	else:
		end = n
	for i in range(end, 0, -2):
		print(i, end=' ')
	print(4, 2, end=' ')
	for i in range(6, n + 1, 2):
		print(i, end=' ')
	print()
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


from sys import stdin
import collections

def solve(tc):
	n = int(stdin.readline().strip())
	if n < 4:
		print(-1)
		return
	base = collections.deque()
	base.extend([2, 4, 1, 3])
	p = 5
	while p + 1 <= n:
		base.append(p)
		base.appendleft(p + 1)
		p += 2
	if p == n:
		base.append(p)
	for x in base:
		print(x, end=' ')
	print()
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	arr = []
	temp = n // 4
	for i in range(0, temp):
		p = i * 4
		arr.append(p + 2)
		arr.append(p + 4)
		arr.append(p + 1)
		arr.append(p + 3)
	if temp == 0:
		print(-1)
	elif n % 4 == 1:
		arr.append(4 * temp + 1)
	elif n % 4 == 2:
		arr = arr[:len(arr) - 1]
		arr.append(4 * temp + 1)
		arr.append(4 * temp - 1)
		arr.append(4 * temp + 2)
	elif n % 4 == 3:
		arr = arr[:len(arr) - 1]
		arr.append(4 * temp + 1)
		arr.append(4 * temp + 3)
		arr.append(4 * temp - 1)
		arr.append(4 * temp + 2)
	print(*arr)
testcase(int(inp()))


def solve(n):
	if n < 4:
		return None
	i = n
	result = []
	while i > 0:
		if i % 2 == 1:
			result.append(i)
		i -= 1
	result.append(4)
	result.append(2)
	i = 5
	while i <= n:
		if i % 2 == 0:
			result.append(i)
		i += 1
	return result
for i in range(int(input())):
	n = int(input())
	result = solve(n)
	print('-1' if result is None else ' '.join(map(str, result)))


from itertools import product, combinations
from math import sqrt, gcd, ceil
INF = int(1000000000.0 + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	elif n == 4:
		print(3, 1, 4, 2)
	elif n == 5:
		print(3, 1, 4, 2, 5)
	elif n % 2 == 0:
		a = [i for i in range(1, n - 4, 2)]
		b = [i for i in range(n - 4, 0, -2)]
		print(*a, n - 2, n, n - 3, n - 1, *b)
	else:
		a = [i for i in range(1, n + 1, 2)]
		b = [i for i in range(n - 5, 1, -2)]
		print(*a, n - 3, n - 1, *b)


import sys
import math
from collections import defaultdict
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n <= 3:
		print(-1)
		continue
	l = [2, 4, 1, 3]
	cnt = 5
	z = True
	while cnt <= n:
		if z:
			l = [cnt] + l
			z = False
		else:
			l.append(cnt)
			z = True
		cnt += 1
	print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		x = n if n % 2 == 1 else n - 1
		for i in range(x, -1, -2):
			print(i, end=' ')
		print('4 2', end=' ')
		for i in range(6, n + 1, 2):
			print(i, end=' ')
		print('')


def main():
	caseNum = int(input())
	for _ in range(caseNum):
		n = int(input())
		if n == 1:
			print(1)
		elif n in [2, 3]:
			print(-1)
		elif n == 4:
			print('3 1 4 2')
		elif n == 5:
			print('5 3 1 4 2')
		elif n % 2 == 0:
			for i in range(n - 1, 1, -2):
				print(f'{i}', end=' ')
			print('1 4 2', end=' ')
			for i in range(6, n, 2):
				print(f'{i}', end=' ')
			print(n)
		else:
			for i in range(n, 1, -2):
				print(f'{i}', end=' ')
			print('1 4 2', end=' ')
			for i in range(6, n - 1, 2):
				print(f'{i}', end=' ')
			print(n - 1)
main()


def main(n):
	if n > 4:
		strr = ''
		for i in range(1, n + 1, 2):
			strr += str(i)
			strr += ' '
		if n % 2 == 0:
			a = n - 4
		else:
			a = n - 3
		strr += str(a) + ' '
		if n % 2 == 0:
			for i in range(n, 0, -2):
				if i != a:
					strr += str(i)
					strr += ' '
		else:
			for i in range(n - 1, 0, -2):
				if i != a:
					strr += str(i)
					strr += ' '
		print(strr)
	if n < 4:
		print(-1)
	if n == 4:
		print('2 4 1 3')
for _ in range(int(input())):
	n = int(input())
	main(n)


cases = int(input())
for t in range(cases):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		a = list(range(1, n + 1, 2)) + list(range(2, n + 1, 2))[::-1]
		mid = n // 2
		if n % 2 != 0:
			p = mid + 1
			(a[p], a[p + 1]) = (a[p + 1], a[p])
		else:
			p = mid - 1
			(a[p], a[p - 1]) = (a[p - 1], a[p])
		print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
		continue
	a = []
	start = n & 1
	for i in range(start, n, 2):
		a.append(i + 1)
	(a[-1], a[-2]) = (a[-2], a[-1])
	start ^= 1
	for i in reversed(range(start, n, 2)):
		a.append(i + 1)
	print(' '.join(map(str, a)))


t = int(input())

def permutation(n):
	if n < 4:
		return [-1]
	perm = []
	quart = n // 4
	for i in range(quart):
		perm.append(4 * i + 2)
		perm.append(4 * i + 4)
		perm.append(4 * i + 1)
		perm.append(4 * i + 3)
	if n % 4 == 1:
		perm.append(n)
	elif n % 4 == 2:
		perm[-1] = n - 1
		perm.append(n - 3)
		perm.append(n)
	elif n % 4 == 3:
		perm[-3] = n - 1
		perm[-2] = n - 3
		perm[-1] = n - 6
		perm.append(n - 2)
		perm.append(n - 4)
		perm.append(n)
	return perm
for _ in range(t):
	n = int(input())
	print(' '.join(map(str, permutation(n))))


for p in range(0, int(input())):
	n = int(input())
	lista = []
	if n >= 4:
		if n % 2 == 0:
			for i in range(n - 1, 0, -2):
				lista.append(i)
		else:
			for i in range(n, 0, -2):
				lista.append(i)
		lista.append(4)
		lista.append(2)
		for i in range(6, n + 1, 2):
			lista.append(i)
	else:
		lista.append(-1)
	print(*lista)


N = int(input())
for i in range(N):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		for i in range(n, 0, -1):
			if i % 2 != 0:
				print(i, end=' ')
		print(4, end=' ')
		for j in range(1, n + 1):
			if j % 2 == 0 and j != 4:
				print(j, end=' ')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
from collections import deque

def solve(n):
	if n < 4:
		return [-1]
	q = deque([n - 1, n - 3, n, n - 2])
	for i in range(4, n):
		if i % 2 == 0:
			q.appendleft(n - i)
		else:
			q.append(n - i)
	return q

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		Ans = solve(n)
		sys.stdout.write(' '.join(map(str, Ans)) + '\n')
main()


for i1 in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
		continue
	elif n == 4:
		print(3, 1, 4, 2)
		continue
	c = 3
	d = 2
	t = 0
	l1 = [1] * n
	i = 1
	while i < n:
		if t == 0 and c <= n and (c + 2 <= n):
			l1[i] = c
			i = i + 1
			c += 2
			l1[i] = c
			i = i + 1
			c += 2
			t = 1
		elif t == 1 and (d <= n and d + 2 <= n):
			l1[i] = d
			i = i + 1
			d += 2
			l1[i] = d
			i = i + 1
			d += 2
			t = 0
		elif t == 1 or (d <= n and d + 2 <= n):
			l1[i] = d
			i = i + 1
			d += 2
			l1[i] = d
			i = i + 1
			d += 2
			t = 0
		else:
			break
	if l1[-1] == 1:
		l1[-1] = n
		if n % 2 != 0:
			l1[-2] = l1[-3]
			l1[-3] = n - 1
	if n % 4 == 0:
		l1[-2] = n - 1
		(l1[-2], l1[-5]) = (l1[-5], l1[-2])
		(l1[-2], l1[-3]) = (l1[-3], l1[-2])
	for i in l1:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	a = int(input())
	if a < 4:
		print(-1)
	else:
		l = [0] * a
		if a % 2:
			la = a // 2 + 1
			z = 1
			l[0] = z
			for i in range(1, la):
				z += 2
				l[i] = z
			z -= 3
			l[la] = z
			z += 2
			l[la + 1] = z
			z -= 4
			if z > 0:
				l[la + 2] = z
				for i in range(1, a // 2 - 2):
					z -= 2
					l[la + 2 + i] = z
		else:
			la = a // 2
			z = 2
			l[0] = z
			for i in range(1, la):
				z += 2
				l[i] = z
			z -= 3
			l[la] = z
			z += 2
			l[la + 1] = z
			z -= 4
			if z > 0:
				l[la + 2] = z
				for i in range(1, la - 2):
					z -= 2
					l[la + 2 + i] = z
		print(*l)


for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(-1)
	else:
		arr = [0] * n
		(i, j) = (0, n - 1)
		while n > 4:
			arr[i] = n
			n -= 1
			i += 1
			arr[j] = n
			n -= 1
			j -= 1
		arr[i] = 3
		arr[i + 1] = 1
		arr[i + 2] = 4
		arr[i + 3] = 2
		print(*arr)


for i in range(int(input())):
	N = int(input())
	List = [2, 4, 1, 3]
	if N <= 3:
		print(-1)
	else:
		for i in range(5, N + 1):
			if i & 1:
				List.insert(0, i)
			else:
				List.append(i)
		print(*List)


def solution(n):
	if n <= 3:
		print('-1')
		return
	res = []
	for k in range(1, n // 4):
		res.append(4 * k - 2)
		res.append(4 * k)
		res.append(4 * k - 3)
		res.append(4 * k - 1)
	z = n // 4
	if n % 4 == 0:
		res.append(4 * z - 2)
		res.append(4 * z)
		res.append(4 * z - 3)
		res.append(4 * z - 1)
	if n % 4 == 1:
		res.append(4 * z - 2)
		res.append(4 * z)
		res.append(4 * z - 3)
		res.append(4 * z - 1)
		res.append(4 * z + 1)
	if n % 4 == 2:
		res.append(4 * z - 2)
		res.append(4 * z + 1)
		res.append(4 * z - 1)
		res.append(4 * z + 2)
		res.append(4 * z)
		res.append(4 * z - 3)
	if n % 4 == 3:
		res.append(4 * z - 2)
		res.append(4 * z + 2)
		res.append(4 * z)
		res.append(4 * z - 3)
		res.append(4 * z - 1)
		res.append(4 * z + 1)
		res.append(4 * z + 3)
	print(' '.join(map(str, res)))
inp = int(input())
for _ in range(inp):
	n = int(input())
	solution(n)


t = int(input())
while t > 0:
	print()
	n = int(input())
	temp = n
	if n < 4:
		print('-1')
	else:
		while n > 0:
			if n & 1 == 1:
				print(n, end=' ')
			n = n - 1
		print('4 2', end=' ')
		n = 6
		if temp >= 6:
			while n <= temp:
				print(n, end=' ')
				n = n + 2
	t = t - 1


import sys
input = sys.stdin.readline
pat4 = [2, 4, 1, 3]
pat5 = [2, 4, 1, 3, 5]
pat6 = [2, 4, 1, 5, 3, 6]
pat7 = [2, 4, 1, 5, 7, 3, 6]
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print('-1')
		continue
	loop = n // 4 - 1
	rest = n % 4 + 4
	ans = []
	for i in range(loop):
		base = i * 4
		ans += [base + 2, base + 4, base + 1, base + 3]
	if rest == 4:
		for item in pat4:
			ans.append(loop * 4 + item)
	elif rest == 5:
		for item in pat5:
			ans.append(loop * 4 + item)
	elif rest == 6:
		for item in pat6:
			ans.append(loop * 4 + item)
	elif rest == 7:
		for item in pat7:
			ans.append(loop * 4 + item)
	print(*ans)


for q in range(int(input())):
	n = int(input())
	if n == 2 or n == 3:
		print(-1)
	else:
		half = int(n / 2)
		if n % 2 == 0:
			n -= 1
		for i in range(n, 0, -2):
			print(i, end=' ')
		print(4, 2, end=' ')
		for i in range(3, half + 1):
			print(i * 2, end=' ')


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for h in range(ri()):
	nn = ri()
	n = nn
	while n > 6:
		print(n, end=' ')
		n -= 2
	if n == 6:
		print('6 2 4 1 3 5', end=' ')
		n = 7
	elif n == 5:
		print('5 3 1 4 2', end=' ')
		n = 6
	elif n == 4:
		print('3 1 4 2', end=' ')
	else:
		print('-1', end=' ')
	while n < nn:
		print(n, end=' ')
		n += 2
	print()


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	if n < 4:
		print(-1)
	else:
		res = []
		for i in range(1, n + 1, 2)[::-1]:
			res.append(i)
		res.extend([4, 2])
		for i in range(6, n + 1, 2):
			res.append(i)
		print(*res)


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	ans = list(range(n - 4, 0, -2))[::-1] + [n - 2, n, n - 3, n - 1] + list(range(n - 5, 0, -2))
	print(*ans)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
		continue
	else:
		dq = deque([2, 4, 1, 3])
		for i in range(5, n + 1):
			if i % 2 == 0:
				dq.append(i)
			else:
				dq.appendleft(i)
		print(*dq)


import math
t = int(input())
for tr in range(t):
	k = int(input())
	n = k
	if n >= 4:
		l = [-1 for i in range(n)]
		left = 0
		if n % 2 == 0:
			n = n - 1
		while n > 0:
			l[left] = n
			left += 1
			n -= 2
		l[left] = 4
		left += 1
		l[left] = 2
		left += 1
		n = 6
		while n <= k:
			l[left] = n
			left += 1
			n = n + 2
		for ii in l:
			print(ii, end=' ')
		print('')
	else:
		print(-1)


for u in range(int(input())):
	n = int(input())
	if n < 4:
		print(-1)
	else:
		x = list(range(1, n + 1, 2))
		y = list(range(6, n + 1, 2))
		s = x[::-1] + [4, 2] + y
		print(*s)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n == 4:
		print('3 1 4 2')
	else:
		ans = []
		for x in range(1, n + 1):
			if x & 1:
				ans.append(str(x))
		ans2 = []
		for x in range(2, n + 1):
			if x % 2 == 0:
				ans2.append(str(x))
		ans2 = ans2[::-1]
		if n % 2 == 0:
			(ans2[1], ans2[2]) = (ans2[2], ans2[1])
		(ans2[0], ans2[1]) = (ans2[1], ans2[0])
		print(' '.join(ans + ans2))


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	odd = []
	even = []
	if n <= 3:
		print(-1)
	else:
		odd = []
		even = [4, 2]
		for i in range(1, n + 1, 2):
			odd.append(i)
		for i in range(6, n + 1, 2):
			even.append(i)
		odd = sorted(odd, reverse=True)
		ans = odd + even
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 3:
		print(-1)
	elif n % 2 == 0:
		a = n // 2
		b = a - 2
		ans = []
		for j in range(b):
			ans.append(2 * j + 1)
		ans.append(n - 1)
		ans.append(n - 3)
		for j in range(a):
			ans.append(n - 2 * j)
		print(' '.join((str(x) for x in ans)))
	else:
		a = n // 2
		b = a - 2
		ans = []
		for j in range(b):
			ans.append(2 * (j + 1))
		ans.append(n - 1)
		ans.append(n - 3)
		for j in range(a + 1):
			ans.append(n - 2 * j)
		print(' '.join((str(x) for x in ans)))


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	if n < 4:
		print(-1)
	else:
		ans = [3, 1, 4, 2]
		for i in range(5, n + 1):
			if i % 2:
				ans = [i] + ans
			else:
				ans += [i]
		print(*ans)


n = int(input())
for i in range(n):
	a = int(input())
	if a < 4:
		print(-1)
	else:
		if a % 2 == 1:
			l = []
			for j in range(a // 2 + 1):
				l.append(a - j * 2)
			l.append(4)
			l.append(2)
			for j in range(a // 2 - 2):
				l.append(j * 2 + 6)
			l = [str(x) for x in l]
			print(' '.join(l))
		if a % 2 == 0 and a > 4:
			l = []
			for j in range(a // 2):
				l.append(a - j * 2)
			l.append(5)
			l.append(1)
			l.append(3)
			for j in range(a // 2 - 3):
				l.append(j * 2 + 7)
			l = [str(x) for x in l]
			print(' '.join(l))
		if a == 4:
			l = [3, 1, 4, 2]
			l = [str(x) for x in l]
			print(' '.join(l))


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	if n <= 3:
		print(-1)
		continue
	result = []
	odd = n - (not n % 2)
	even = n - n % 2
	while odd >= 1:
		result.append(odd)
		odd -= 2
	result.append(4)
	result.append(2)
	i = 6
	while i <= even:
		result.append(i)
		i += 2
	print(*result)


for i in range(int(input())):
	x = int(input())
	if x < 4:
		print(-1)
		continue
	hech = list()
	for j in range(x - 1 + x % 2, 3, -2):
		hech.append(j)
	chet = list()
	for j in range(6, x + 1, 2):
		chet.append(j)
	arr = [3, 1, 4, 2]
	print(*hech, *arr, *chet)


for _ in range(int(input())):
	n = int(input())
	even = []
	odd = []
	if n < 4:
		print('-1')
	else:
		for i in range(1, n + 1):
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		print(*sorted(odd, reverse=True) + sorted(even[:2], reverse=True) + even[2:])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def dfs(source):
	path.append(source)
	vis[source] = True
	for child in graph[source]:
		if not vis[child]:
			dfs(child)
for _ in range(int(data())):
	n = int(data())
	if n <= 3:
		out(-1)
		continue
	graph = dd(set)
	stack = [1]
	s = set()
	while stack:
		temp = stack.pop()
		for i in range(2, 5):
			if temp + i <= n:
				graph[temp].add(temp + i)
				if temp + i not in s:
					s.add(temp + i)
					stack.append(temp + i)
		if temp >= 3:
			for i in range(2, 5):
				if temp - i > 0:
					graph[temp].add(temp - i)
					if temp - i not in s:
						stack.append(temp - i)
						s.add(temp - i)
	for i in range(1, n + 1):
		vis = dd(lambda : False)
		path = []
		dfs(i)
		r = True
		for j in range(len(path) - 1):
			if 2 <= abs(path[j] - path[j + 1]) <= 4:
				continue
			r = False
			break
		if r:
			out(*path)
			break


def permutation(n):
	if n == 1:
		return [n]
	if n < 4:
		return []
	odds = []
	evens = [a for a in range(2, n + 1, 2)]
	(evens[1], evens[0]) = (evens[0], evens[1])
	if n % 2 == 1:
		odds = [a for a in range(n, 0, -2)]
	else:
		odds = [a for a in range(n - 1, 0, -2)]
	return odds + evens

def printList(lst):
	for v in lst:
		print(v, end=' ')
	print()
t = int(input())
for i in range(t):
	n = int(input())
	perm = permutation(n)
	if not perm:
		print(-1)
	else:
		printList(perm)