You are given a positive integer $n$, it is guaranteed that $n$ is even (i.e. divisible by $2$).

You want to construct the array $a$ of length $n$ such that:   The first $\frac{n}{2}$ elements of $a$ are even (divisible by $2$);  the second $\frac{n}{2}$ elements of $a$ are odd (not divisible by $2$);  all elements of $a$ are distinct and positive;  the sum of the first half equals to the sum of the second half ($\sum\limits_{i=1}^{\frac{n}{2}} a_i = \sum\limits_{i=\frac{n}{2} + 1}^{n} a_i$). 

If there are multiple answers, you can print any. It is not guaranteed that the answer exists.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of the test case contains one integer $n$ ($2 \le n \le 2 \cdot 10^5$) — the length of the array. It is guaranteed that that $n$ is even (i.e. divisible by $2$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$ ($\sum n \le 2 \cdot 10^5$).


-----Output-----

For each test case, print the answer — "NO" (without quotes), if there is no suitable answer for the given test case or "YES" in the first line and any suitable array $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$) satisfying conditions from the problem statement on the second line.


-----Example-----
Input
5
2
4
6
8
10

Output
NO
YES
2 4 1 5
NO
YES
2 4 6 8 1 3 5 11
NO

Difficulty: EASY
Tags: Mathematics

Constructive algorithms

Starter code:

Solutions:
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = []
	b = []
	d = []
	for i in range(0, n // 2):
		b.append(l[i] + l[n - i - 1])
		d.append(max(l[i], l[n - i - 1]) + k)
		a.append(min(l[i], l[n - i - 1]))
	b.sort()
	d.sort()
	a.sort()
	c = []
	last = -1
	cnt = 0
	for i in b:
		if last == -1:
			last = i
			cnt = 1
		elif last == i:
			cnt += 1
		else:
			c.append([last, cnt])
			cnt = 1
			last = i
	c.append([last, cnt])
	ans = n - 2
	curr = n
	i = 0
	j = 0
	k = 0
	sa = len(a)
	sc = len(c)
	sd = len(d)
	while i < sa and j < sc and (k < sd):
		if curr < ans:
			ans = curr
		if c[j][0] <= a[i] and c[j][0] <= d[k]:
			if curr - c[j][1] < ans:
				ans = curr - c[j][1]
			j += 1
		elif a[i] <= d[k]:
			curr -= 1
			i += 1
		else:
			curr += 1
			k += 1
	while j < sc and k < sd:
		if curr < ans:
			ans = curr
		if c[j][0] <= d[k]:
			if curr - c[j][1] < ans:
				ans = curr - c[j][1]
			j += 1
		else:
			curr += 1
			k += 1
	if curr < ans:
		ans = curr
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		m = n * 2
		(res1, res2) = ([], [])
		for j in range(n // 4):
			x = 2 * j + 1
			res1.append(x)
			res1.append(m - x)
			res2.append(x + 1)
			res2.append(m - x - 1)
		print('YES')
		print(*res2, *res1)


def f1(n):
	if n // 2 % 2:
		print('NO')
		return False
	arr = []
	for i in range(n // 2):
		arr.append(i * 2 + 2)
	for i in range(n // 2):
		arr.append(i * 2 + 1)
	print('YES')
	arr[-1] += n // 2
	for m in arr:
		print(m, end=' ')
	return True
T = int(input())
for i in range(T):
	n = int(input())
	f1(n)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, k) = mapi()
	mp = defaultdict(int)
	a = list(mapi())
	x = 0
	res = float('inf')
	mx = [0] * (n // 2)
	mn = [0] * (n // 2)
	for i in range(n // 2):
		mp[a[i] + a[n - i - 1]] += 1
		mx[i] = max(a[i], a[n - i - 1]) + k
		mn[i] = min(a[i], a[n - i - 1]) + 1
	mn.sort()
	mx.sort()
	for i in range(1, 2 * k + 1):
		tmp = i
		a = bisect.bisect_right(mn, tmp) + 1
		b = bisect.bisect_right(mx, tmp - 1) + 1
		res = min(res, 2 * (n // 2) - a + b - mp[tmp])
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		z = list()
		for i in range(n // 2):
			z.append(i * 2 + 2)
		for i in range(n // 2 - 1):
			z.append(i * 2 + 1)
		z.append(z[n - 2] + 2 + n // 2)
		print(*z)
	else:
		print('NO')


def iseven(n):
	if n % 2 == 0:
		return True
	return False

def isodd(n):
	if n % 2 == 1:
		return True
	return False

def createarray(n):
	even = []
	odd = []
	for i in range(1, n // 2 + 1):
		even.append(2 * i)
		if i <= n // 4:
			odd.append(2 * i - 1)
		else:
			odd.append(2 * i + 1)
	l = []
	l.extend(even)
	l.extend(odd)
	return l

def Print(l):
	for i in l:
		print(i, end=' ')
	print()
n = int(input())
for i in range(n):
	temp = int(input())
	if iseven(temp // 2):
		print('YES')
		Print(createarray(temp))
	else:
		print('NO')


num = int(input())
for _ in range(num):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans1 = [2 * (i + 1) for i in range(n // 2)]
		ans2 = [2 * i + 1 for i in range(n // 2 - 1)]
		ans = ans1 + ans2 + [ans1[-1] + n // 2 - 1]
		print(*ans, sep=' ')


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(2, n // 2 + 1, 2):
			print(i - 1, end=' ')
		for i in range(n // 2 + 2, n + 1, 2):
			print(i + 1, end=' ')
		print(end='\n')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = []
	if n % 4 != 0:
		print('NO')
	elif n == 4:
		print('YES')
		print('2 4 1 5')
	else:
		for i in range(n // 2):
			ans += [2 * i + 2]
		for i in range(n // 2 - 1):
			ans += [2 * i + 1]
		ans += [3 * (n // 2) - 1]
		print('YES')
		for l in ans:
			print(l, end=' ')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		left = list(range(2, n + 1, 2))
		right = list(range(1, n - 1, 2))
		right.append(sum(left) - sum(right))
		print(' '.join([str(x) for x in left + right]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		s = 0
		for i in range(n // 2):
			a.append(2 * (i + 1))
			s += 2 * (i + 1)
		for i in range(n // 2 - 1):
			a.append(2 * (i + 1) - 1)
			s -= 2 * (i + 1) - 1
		a.append(s)
		print(' '.join(map(str, a)))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = [x for x in range(2, n + 1, 2)]
		b = [x for x in range(1, n - 1, 2)]
		print(' '.join((str(x) for x in a + b + [sum(a) - sum(b)])))


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		list = [0] * n
		sum1 = 0
		sum2 = 0
		k = 2
		for i in range(n // 2):
			list[i] = k
			sum1 += k
			k += 2
		k = 1
		for i in range(n // 2, n - 1):
			list[i] = k
			sum2 += k
			k += 2
		list[n - 1] = sum1 - sum2
		for i in range(n):
			print(list[i], end=' ')
		print('')
	else:
		print('NO')


for q in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		now = 2
		a = []
		for i in range(n // 2):
			print(now, end=' ')
			a.append(now)
			now += 8
		for i in range(n // 2):
			if i % 2 == 0:
				now = a[i] + 1
			else:
				now = a[i] - 1
			print(now, end=' ')
		print()


def generate_arr(n):
	arr = []
	for i in range(1, n + 1):
		arr.append(2 * i)
	for j in range(1, n):
		arr.append(2 * j - 1)
	last = 1 + (n + n // 2 - 1) * 2
	arr.append(last)
	return arr
for i in range(int(input())):
	n = int(input())
	half = n // 2
	if half % 2 != 0:
		print('NO')
	else:
		print('YES')
		print(*generate_arr(half))


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 & 1 == 1:
		print('NO')
	else:
		print('YES')
		st = 2
		left = 0
		ans = []
		for i in range(n // 2):
			left += st
			ans.append(st)
			st += 2
		st = 1
		right = 0
		for i in range(n // 2, n - 1):
			right += st
			ans.append(st)
			st += 2
		ans.append(left - right)
		print(*ans)


t = int(input())
while t != 0:
	n = int(input())
	even_arr = list()
	odd_arr = list()
	initial_even_value = 0
	initial_odd_value = -1
	for i in range(n // 2):
		initial_even_value += 2
		even_arr.append(initial_even_value)
	for i in range(n // 2 - 1):
		initial_odd_value += 2
		odd_arr.append(initial_odd_value)
	if (sum(even_arr) - sum(odd_arr)) % 2 == 1:
		odd_arr.append(sum(even_arr) - sum(odd_arr))
	else:
		odd_arr.append(even_arr[-1] + 1)
	if sum(even_arr) == sum(odd_arr):
		print('YES')
		for i in even_arr:
			print(i, end=' ')
		for i in range(0, len(odd_arr) - 1):
			print(odd_arr[i], end=' ')
		print(odd_arr[-1])
	else:
		print('NO')
	del even_arr
	del odd_arr
	t -= 1


n = int(input())
for i in range(n):
	my_input = int(input())
	checker = True if my_input % 4 == 0 else False
	if not checker:
		print('NO')
	else:
		print('YES')
		e_sum = 0
		e = 0
		for j in range(my_input // 2):
			e += 2
			print(e, end=' ')
			e_sum += e
		o_sum = 0
		o = -1
		for k in range(my_input // 2 - 1):
			o += 2
			print(o, end=' ')
			o_sum += o
		print(e_sum - o_sum)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 4 != int(n / 4):
		print('NO')
	else:
		l = [i for i in range(2, n + 1, 2)]
		m = l[:]
		extra = 0
		for i in range(0, int(n / 2) - 1):
			m[i] -= 1
			extra += 1
		m[-1] = m[-1] + extra
		l = l + m
		print('YES')
		print(*l)


for i in range(int(input())):
	g = int(input())
	if g // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, g // 2):
			print(2 * j, end=' ')
		print(g // 2 + j * 2 + 2, end=' ')
		for j in range(g // 2):
			print(2 * j + 3, end=' ')
		print('')


t = int(input())
for i in range(t):
	lse = []
	lso = []
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, n):
			if j % 2 == 0:
				lse.append(j)
		a = int(lse[-1] + 2 + n / 2)
		lse.append(a)
		for k in range(2, n + 2):
			if k % 2 == 1:
				lso.append(k)
		lse.extend(lso)
	for m in range(len(lse)):
		print(lse[m], end=' ')


def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		Sum = [0] * (2 * k + 2)
		Sum[0] = n
		m = 0
		for i in range(n // 2):
			x = a[i] + a[n - 1 - i]
			Sum[x] += -1
			Sum[x + 1] += 1
			x = min(a[i], a[n - 1 - i]) + 1
			Sum[x] += -1
			x = max(a[i], a[n - 1 - i]) + k
			Sum[x + 1] += 1
		m = Sum[0]
		for i in range(1, 2 * k + 2):
			Sum[i] += Sum[i - 1]
			m = min(m, Sum[i])
		print(m)
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
		continue
	print('YES')
	a = list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [n // 4 * 6 - 1]
	print(' '.join((str(x) for x in a)))


t = int(input())
inf = float('INF')

def u(i, v):
	i += 2 * k
	tr[i] += v
	while i > 1:
		i >>= 1
		tr[i] = tr[i << 1] + tr[i << 1 | 1]

def q(i):
	l = 2 * k + 1
	r = i + 2 * k + 1
	res = 0
	while l < r:
		if l & 1:
			res += tr[l]
			l += 1
		if r & 1:
			r -= 1
			res += tr[r]
		l >>= 1
		r >>= 1
	return res
for _ in range(t):
	(n, k) = map(int, input().split())
	aa = list(map(int, input().split()))
	tr = [0 for i in range(4 * (2 * k + 5))]
	for i in range(n // 2):
		x = aa[i] + aa[n - 1 - i]
		a = 1 + min(aa[i], aa[n - 1 - i])
		b = k + max(aa[i], aa[n - 1 - i])
		if a < x and x < b:
			u(1, 2)
			u(a - 1, -1)
			u(x - 1, -1)
			u(x, 1)
			u(b, 1)
		elif x == a and x == b:
			u(1, 2)
			u(x - 1, -2)
			u(x, 2)
		elif x == a:
			u(1, 2)
			u(x - 1, -2)
			u(x, 1)
			u(b, 1)
		elif x == b:
			u(1, 2)
			u(a - 1, -1)
			u(x - 1, -1)
			u(x, 2)
	ans = n
	for i in range(1, 2 * k):
		ans = min(ans, q(i))
	print(ans)


for t in range(int(input())):
	n = int(input())
	sum = 0
	if n % 4 != 0:
		print('NO')
	else:
		a = [2] * n
		for i in range(n // 2):
			a[i] = (i + 1) * 2
			sum += a[i]
		for i in range(n // 2 - 1):
			a[i + n // 2] = i * 2 + 1
			sum -= a[i + n // 2]
		a[n - 1] = sum
		print('YES')
		for i in range(n):
			print(a[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		x = 2
		for i in range(n // 2):
			l.append(x)
			x = x + 2
		s = sum(l)
		add = 0
		y = 1
		add += y
		z = []
		for j in range(n // 2 - 1):
			z.append(y)
			y += 2
		q = sum(z)
		z.append(s - q)
		print(*l, end=' ')
		print(*z)


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	if n % 4:
		print('NO')
		continue
	ans = []
	sm = 0
	for i in range(2, n + 1, 2):
		sm += i
		ans.append(i)
	for i in range(1, n - 1, 2):
		sm -= i
		ans.append(i)
	ans.append(sm)
	print('YES')
	print(*ans)


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	sum = 0
	print('YES')
	for i in range(2, n + 1, 2):
		sum += i
		print(i, end=' ')
	for i in range(1, n - 1, 2):
		sum -= i
		print(i, end=' ')
	print(sum)


t = int(input())
while t:
	t -= 1
	n = int(input())
	res = n // 2
	if res % 2 == 1:
		print('NO')
	else:
		od = []
		ev = []
		for i in range(2, n + 1, 2):
			ev += [i]
		for i in range(1, n - 2, 2):
			od += [i]
		ans = sum(ev) - sum(od)
		od += [ans]
		print('YES')
		for i in ev:
			print(i, end=' ')
		for i in od:
			print(i, end=' ')
		print()


t = int(input())
even = []
odd = []
for i in range(6, 5 * 10 ** 5, 8):
	odd.append(i + 1)
	odd.append(i - 1)
	even.append(i - 2)
	even.append(i + 2)
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		total = even[:n // 2] + odd[:n // 2]
		print(' '.join(map(str, total)))
	else:
		print('NO')


DEBUG = False
t = int(input())
for case in range(t):
	(n, k) = map(int, input().split())
	p = n // 2
	sums = (2 * k - 1) * [0]
	(bottom_half, top_half) = (k * [0], k * [0])
	array = [int(x) for x in input().split()]
	for i in range(p):
		a = min(array[i], array[n - i - 1])
		b = max(array[i], array[n - i - 1])
		bottom_half[a - 1] += 1
		top_half[b - 1] += 1
		sums[a + b - 2] += 1
	countb = 0
	cum_bottom = k * [0]
	for i in range(k):
		countb += bottom_half[k - i - 1]
		cum_bottom[k - i - 1] += countb
	countt = 0
	cum_top = k * [0]
	for i in range(k):
		countt += top_half[i]
		cum_top[i] += countt
	if DEBUG:
		print(cum_bottom)
		print(cum_top)
	cum_bottom.pop(0)
	cum_top.pop()
	combined_halves = cum_bottom + [0] + cum_top
	answer = p
	for m in range(2 * k - 1):
		answer = min(p - sums[m] + combined_halves[m], answer)
	print(answer)
	if DEBUG:
		print(combined_halves)
		print(sums)


count_of_tests = int(input())
for i in range(count_of_tests):
	n = int(input())
	if (n // 2 - 1) % 2 == 0:
		print('NO')
		continue
	chet_mas = []
	ne_mas = []
	point = 2
	for j in range(n // 2):
		if j != n // 2 - 1:
			chet_mas.append(point)
			ne_mas.append(point - 1)
			point += 2
		else:
			chet_mas.append(point)
			ne_mas.append(point + j)
	itog = []
	itog.extend(chet_mas)
	itog.extend(ne_mas)
	print('YES')
	for m in itog:
		print(m, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		l = [2]
		k = n // 2
		for j in range(0, k - 1):
			l.append(l[-1] + 2)
		p = sum(l)
		l.append(1)
		for j in range(0, k - 2):
			l.append(l[-1] + 2)
		l.append(p - sum(l[k:]))
		print('YES')
		for j in l:
			print(j, end=' ')
		print()


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

def tup(a, b):
	if b == -1:
		return a * 2 + 0
	return a * 2 + 1

def untup(t):
	(a, b) = divmod(t, 2)
	if b == 0:
		b = -1
	return (a, b)

def solve(N, K, A):
	cost = N
	best = N
	points = []
	for i in range(N // 2):
		j = N - 1 - i
		x = A[i]
		y = A[j]
		if x > y:
			(x, y) = (y, x)
		lo = x + 1
		hi = min(y + K, 2 * K)
		points.append(tup(lo, -1))
		points.append(tup(x + y, -1))
		points.append(tup(x + y, +1))
		points.append(tup(hi, +1))
	points.sort()
	for t in points:
		(_, delta) = untup(t)
		cost += delta
		best = min(best, cost)
	return best
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, K) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, K, A)
	print(ans)


def solve(n):
	list = []
	if int(n / 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(n / 2) + 1):
			list.append(2 * i)
		for i in range(0, int(n / 2) - 1):
			list.append(1 + i * 2)
		k = int(n / 2) * (int(n / 2) + 1) - (int(n / 2) - 1) ** 2
		list.append(k)
		print(*list, sep=' ')
test_cases = int(input())
list1 = []
for i in range(test_cases):
	list1.append(int(input()))
for i in range(test_cases):
	solve(list1[i])


class ST:

	def __init__(self, arr):
		self.n = len(arr)
		self.a = [0] * (2 * self.n)
		self.func = lambda a, b: a + b

	def rangequery(self, l, r):
		res = 0
		l += self.n
		r += self.n
		while l < r:
			if l & 1:
				res += self.a[l]
				l += 1
			if r & 1:
				r -= 1
				res += self.a[r]
			l = l >> 1
			r = r >> 1
		return res

	def pointupdate(self, x, val):
		i = x + self.n
		while i:
			self.a[i] += val
			i = i >> 1

	def pointquery(self, x):
		res = 0
		i = x + self.n
		while i:
			res += self.a[i]
			i >>= 1
		return res

	def rangeupdate(self, l, r, val):
		r += 1
		l += self.n
		r += self.n
		while l < r:
			if l & 1:
				self.a[l] += val
				l += 1
			if r & 1:
				r -= 1
				self.a[r] += val
			l = l >> 1
			r = r >> 1
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')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	arr = [0] * (2 * k + 1)
	st = ST(arr)
	di = {}
	while i < j:
		(mi, ma) = (min(a[i], a[j]), max(a[i], a[j]))
		s = str(mi) + ',' + str(ma)
		di[s] = 1 if s not in di else di[s] + 1
		i += 1
		j -= 1
	for each in di:
		(mi, ma) = [int(k) for k in each.split(',')]
		total = mi + ma
		st.rangeupdate(0, mi, 2 * di[each])
		st.rangeupdate(mi + 1, total - 1, 1 * di[each])
		if total != 2 * k:
			st.rangeupdate(total + 1, ma + k, 1 * di[each])
		if ma != k:
			st.rangeupdate(ma + k + 1, 2 * k, 2 * di[each])
	print(min([st.pointquery(k) for k in range(2 * k + 1)]))


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

def read():
	return list(map(int, input().strip().split()))
for i in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		arr = [0] * n
		for i in range(n // 2):
			arr[i] = (i + 1) * 2
		for j in range(n // 2, n - 1):
			arr[j] = arr[j - n // 2] - 1
		arr[n - 1] = arr[n // 2 - 1] + n // 2 - 1
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	evens = []
	for i in range(2, n + 1, 2):
		evens.append(i)
	odds = set([])
	for i in range(0, len(evens), 2):
		sum = evens[i] + evens[i + 1]
		cur = evens[i] - 1
		while cur in odds:
			cur -= 2
		odds.add(cur)
		odds.add(sum - cur)
	print(' '.join([str(_) for _ in evens + list(odds)]))


for _ in range(int(input())):
	num = int(input())
	cur = 2
	if num % 4 == 0:
		print('YES')
		for x in range(num // 2):
			print(cur, end=' ')
			cur += 2
		cur = 1
		for x in range(num // 2 - 1):
			print(cur, end=' ')
			cur += 2
		print(cur - 2 + (num // 2 + 2))
	else:
		print('NO')


def balanced(num):
	if num % 4 != 0:
		print('NO')
		return
	eves = [i for i in range(2, num + 1, 2)]
	odds = [i for i in range(1, num + 1, 2)]
	n = num // 2
	ans = []
	ans.extend(eves[:n + 1])
	ans.extend(odds[:n - 1])
	val = sum(eves[:n + 1]) - sum(odds[:n - 1])
	ans.append(val)
	print('YES')
	for i in ans:
		print(i, '', end='')
	print()
t = int(input())
for i in range(t):
	x = int(input())
	balanced(x)


num = int(input())
for i in range(num):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		s = ''
		for i in range(n // 2):
			s += str(2 * i + 2) + ' '
		for i in range(n // 4):
			s += str(2 * i + 1) + ' '
		for i in range(n // 4, n // 2):
			s += str(2 * i + 3) + ' '
		print('YES')
		print(s[:len(s) - 1])


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(n + n // 2 - 1)
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	h = n >> 1
	if h % 2:
		print('NO')
	else:
		print('YES')
		a = list(range(2, n + 1, 2))
		a += list(range(1, n - 2, 2))
		a.append(n + h - 1)
		print(' '.join(map(str, a)))


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()):
		n = II()
		if n % 4:
			print('NO')
			continue
		ans = [0] * n
		for i in range(n // 2):
			ans[i] = (i + 1) * 2
		for i in range(n // 2 - 1):
			ans[i + n // 2] = (i + 1) * 2 - 1
		ans[-1] = sum(ans[:n // 2]) - sum(ans[n // 2:])
		print('YES')
		print(*ans)
main()


import sys

def main():
	T = int(input())
	for _ in range(T):
		(n, k) = map(int, input().split())
		nums = list(map(int, input().split()))
		dp = [0] * (2 * k + 2)
		for i in range(n // 2):
			(a, b) = (nums[i], nums[n - 1 - i])
			if a > b:
				(a, b) = (b, a)
			s = a + b
			lo = s - (b - 1)
			hi = s + (k - a)
			dp[lo] -= 1
			dp[s] -= 1
			dp[s + 1] += 1
			dp[hi + 1] += 1
		mn = n
		cur = n
		for i in range(2, 2 * k + 1):
			cur += dp[i]
			mn = min(cur, mn)
		print(mn)
main()


for t in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		k = n // 2
		num1 = k * k + k
		num2 = (k - 1) * (k - 1)
		num3 = num1 - num2
		a1 = list(range(2, k * 2 + 2, 2))
		a2 = list(range(1, k * 2 - 1, 2))
		print(*a1, *a2, num3)


T = int(input())
for t in range(T):
	N = int(input())
	if N // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		even = []
		odd = []
		diff = 0
		for i in range(1, N // 2 + 1):
			even.append(i * 2)
			diff += 1
			if i == N // 2:
				odd.append(1 + (i - 1) * 2 + diff)
			else:
				odd.append(1 + (i - 1) * 2)
		for x in even + odd:
			print(x, end=' ')


import math
t = int(input())
for g in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(0, int(n / 2)):
			a.append(2 * (i + 1))
		for i in range(0, int(n / 2)):
			a.append(2 * i + 1)
		a[n - 1] = a[n - 1] + n / 2
		for i in range(0, n):
			print(int(a[i]), end=' ')
		print('')


from itertools import accumulate
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k += 1
	cnt = [0] * (k * 2)
	l = list(map(int, input().split()))
	for (i, (a, b)) in enumerate(zip(l, l[:-1 - n // 2:-1]), 1):
		if a > b:
			(a, b) = (b, a)
		cnt[a + 1] -= 1
		cnt[a + b] -= 1
		cnt[a + b + 1] += 1
		cnt[b + k] += 1
	print(n + min(accumulate(cnt)))


def solve(n):
	l = int(n / 2)
	if l % 2 == 1:
		print('NO')
		return None
	print('YES')
	odd = []
	even = []
	for i in range(1, l + 1):
		even.append(i * 2)
		if i == l:
			odd.append(sum(even) - sum(odd))
			break
		odd.append(i * 2 - 1)
	ans = list(map(str, even + odd))
	print(' '.join(ans))
	return None
no = int(input())
for q in range(no):
	n = int(input())
	solve(n)


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

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

def main():

	def solve():
		(n, k) = map(int, input().split())
		aa = [int(a) for a in input().split()]
		saa = [0] * (n // 2)
		mnv = [0] * (n // 2)
		mxv = [0] * (n // 2)
		for i in range(n // 2):
			saa[i] = aa[i] + aa[-i - 1]
			mnv[i] = min(aa[i], aa[-i - 1]) + 1
			mxv[i] = max(aa[i], aa[-i - 1]) + k
		saac = Counter(saa).most_common()
		saac.sort()
		mnv.sort()
		mxv.sort()
		mnp = 0
		mxp = 0
		best = n // 2
		for (s, c) in saac:
			while mnp < n // 2 and mnv[mnp] <= s:
				mnp += 1
			while mxp < n // 2 and mxv[mxp] < s:
				mxp += 1
			opt = n - c - mnp + mxp
			best = min(best, opt)
		print(best)
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		ans = [2]
		s = 2
		for i in range(n // 2 - 1):
			ans.append(ans[-1] + 2)
			s += ans[-1]
		s2 = 0
		for i in range(n // 2 - 1):
			ans.append(ans[i] - 1)
			s2 += ans[-1]
		ans.append(abs(s2 - s))
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		count = 2
		for j in range(n // 2):
			print(count, end=' ')
			count += 2
		count = 1
		for j in range(n // 2 - 1):
			print(count, end=' ')
			count += 2
		print(count + n // 2)


def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n // 2 % 2 != 0:
			print('NO')
		else:
			a = []
			b = []
			j = 2
			while len(a) != n // 2:
				a.append(j)
				j += 2
			j = 1
			while len(b) != n // 2 - 1:
				b.append(j)
				j += 2
			b.append(sum(a) - sum(b))
			print('YES')
			print(' '.join((str(s) for s in a + b)))
solve()


from sys import stdin
input = stdin.readline
t = int(input())
for iwuehufiew in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	odc = [[1 + min(l[i], l[n - 1 - i]), k + max(l[i], l[n - 1 - i])] for i in range(n // 2)]
	cyk = [0] * (2 * k + 2)
	for o in odc:
		cyk[o[0]] += 1
		cyk[o[1] + 1] -= 1
	cov = [0] * (2 * k + 2)
	cov[0] = cyk[0]
	for i in range(1, 2 * k + 2):
		cov[i] = cov[i - 1] + cyk[i]
	ilosc = [0] * (2 * k + 1)
	for i in range(n // 2):
		ilosc[l[i] + l[n - 1 - i]] += 1
	wyn = 759237598237985732489
	for i in range(2 * k + 1):
		a = cov[i] + (n // 2 - cov[i]) * 2 - ilosc[i]
		wyn = min(wyn, a)
	print(wyn)


t = int(input())
a = [0] * 200000
for k in range(t):
	n = int(input())
	mid = n // 2
	if mid & 1:
		print('NO')
	else:
		print('YES')
		s = 0
		for k in range(mid):
			a[k] = (k + 1) * 2
			s += a[k]
		for k in range(mid, n - 1):
			a[k] = 2 * (k - mid) + 1
		a[n - 1] = s - (mid - 1) ** 2
		for i in range(n):
			print(a[i], end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		L = []
		Li = []
		for i in range(2, n // 2 + 1, 2):
			L.append(str(i))
			Li.append(str(i - 1))
		for i in range(n // 2 + 2, n + 1, 2):
			L.append(str(i))
			Li.append(str(i + 1))
		ans = L + Li
		print(' '.join(ans))
	else:
		print('NO')


total_cases = int(input())
lengths = [int(input()) for i in range(total_cases)]
for n in lengths:
	if n / 2 % 2 == 1:
		print('NO')
	else:
		seq_1 = list(range(2, int(n / 2 + 2), 2))
		seq_2 = list(range(int(n / 2) + 2, n + 2, 2))
		seq_3 = list(map(lambda x: x - 1, seq_1))
		seq_4 = list(map(lambda x: x + 1, seq_2))
		print('YES')
		print(' '.join(map(str, seq_1 + seq_2 + seq_3 + seq_4)))


t = int(input())
for _ in range(t):
	n = int(input())
	result = []
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				result.append(i)
		for i in range(1, n - 1):
			if i % 2 == 1:
				result.append(i)
		a = sum(result[:n // 2])
		b = sum(result[n // 2:])
		result.append(a - b)
		print(' '.join(map(str, result)))
	elif n // 2 % 2 == 1:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4:
			print('NO')
		else:
			nums = []
			sums = 0
			for i in range(1, n // 2 + 1):
				nums.append(2 * i)
				sums += 2 * i
			tmp = 0
			for i in range(n // 2 - 1):
				nums.append(i * 2 + 1)
				tmp += i * 2 + 1
			nums.append(sums - tmp)
			print('YES')
			print(' '.join(list(map(str, nums))))
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = 2
		c = 1
		b = []
		s1 = 0
		print('YES')
		for j in range(n // 2):
			b.append(a)
			a = a + 2
		for j in range(n // 2, n):
			if j != n - 1:
				b.append(c)
				c = c + 2
				s1 = s1 + b[j]
			else:
				b.append(sum(b[0:n // 2]) - s1)
		print(*b)


for _ in range(int(input())):
	n = int(input())
	even = [e for e in range(1, n + 1) if e % 2 == 0]
	odd = [o for o in range(1, n + 1) if o % 2 != 0]
	odd[-1] = sum(even) - sum(odd[:-1])
	x = even + odd
	if x[-1] % 2 == 0:
		print('NO', end='')
	else:
		print('YES')
		for each in x:
			print(each, end=' ')
	print()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = [0 for i in range(n)]
		start = 2
		for i in range(n // 2):
			a[i] = start
			start += 2
		leave = start // 2
		j = 1
		for i in range(n // 2, n):
			if j != leave:
				a[i] = j
			else:
				j += 2
				a[i] = j
			j += 2
		print(*a)


t = int(input())
for i in range(t):
	arr = []
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			k1 = 2 * (i + 1)
			arr.append(k1)
		for i in range(n // 2 - 1):
			k2 = 2 * i + 1
			arr.append(k2)
		for i in arr:
			print(i, end=' ')
		print(arr[-1] + 2 * (n // 4 + 1))


n = int(input())
array = []
for i in range(n):
	array.append(int(input()))

def calc(x):
	if x // 2 % 2 == 0:
		a = []
		for i in range(2, x + 1, 2):
			a.append(i)
		arr = []
		for i in range(1, x - 1, 2):
			arr.append(i)
		arr.append(sum(a) - sum(arr))
		a = a + arr
		print('YES')
		for i in a:
			print(i, end=' ')
		print('')
	else:
		print('NO')
for x in array:
	calc(x)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		even = 2
		sum1 = 0
		print('YES')
		for i in range(n // 2):
			print(even, end=' ')
			sum1 += even
			even += 2
		odd = 1
		sum2 = 0
		for i in range(n // 2 - 1):
			print(odd, end=' ')
			sum2 += odd
			odd += 2
		print(sum1 - sum2)


i = int(input())
for _ in range(i):
	say = int(input())
	if say % 4 == 0:
		print('YES')
		left = ''.join([f'{j * 2} ' for j in range(1, say // 2 + 1)])
		right = ''.join([f'{j * 2 + 1} ' for j in range(say // 2 - 1)])
		right += f'{(say // 2 - 1) * 2 + 1 + say // 2}'
		print(f'{left} {right}')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = [0] * n
		for i in range(n // 4):
			a[i * 2] = 2 + 10 * i
			a[i * 2 + 1] = 4 + 10 * i
			a[i * 2 + n // 2] = 1 + 10 * i
			a[i * 2 + 1 + n // 2] = 5 + 10 * i
		print(' '.join(map(str, a)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1 or n == 2 or n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	l = []
	i = 2
	for x in range(n // 2):
		l.append(i)
		i += 2
	i = 1
	for x in range(n // 2 - 1):
		l.append(i)
		i += 2
	l.append(i + n // 2)
	print(' '.join([str(x) for x in l]))


from math import *
for i in range(int(input())):
	n = int(input())
	n = n // 2
	if n & 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for i in range(1, n):
		print(i * 2 - 1, end=' ')
	print(3 * n - 1)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x & 1:
		print('No')
	else:
		print('Yes')
		print(*list(range(2, n + 1, 2)), end=' ')
		for i in range(1, n + 2, 2):
			if i != n // 2 + 1:
				print(i, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		a = []
		print('YES')
		l = 2
		for j in range(n // 2):
			a.append(l)
			l += 4
		l = 2
		m = 1
		for j in range(n // 2):
			a.append(l + m)
			l += 4
			m *= -1
		print(*a, sep=' ')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	if k % 2 == 0:
		print('YES', end='\n')
		s = 0
		s1 = 0
		for j in range(2, n + 1, 2):
			s = s + j
			print(j, end=' ')
		for j in range(1, n - 1, 2):
			s1 = s1 + j
			print(j, end=' ')
		print(s - s1, end=' ')
	else:
		print('NO', end='\n')


t = int(input())

def arrayBalancer(x):
	if x / 2 % 2:
		return print('NO')
	evenNums = [i * 2 for i in range(1, int(x / 2) + 1)]
	oddNums = [e - 1 if i < len(evenNums) / 2 else e + 1 for (i, e) in enumerate(evenNums)]
	balancedArray = ' '.join([str(n) for n in evenNums + oddNums])
	return print('Yes' + '\n' + balancedArray)
properEight = [2, 4, 6, 8, 1, 3, 7, 9]
for i in range(t):
	n = int(input())
	arrayBalancer(n)


for t in range(int(input())):
	s = int(input())
	if s % 4 == 0:
		print('YES')
		for i in range(2, s + 1, 2):
			print(i, end=' ')
		k = 1
		y = 1
		while k <= s // 2 - 1:
			print(y, end=' ')
			y += 2
			k += 1
		print(s + s // 2 - 1)
	else:
		print('NO')


t = int(input())
for T in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		evens = [str(i) for i in range(2, n + 1, 2)]
		odds = [str(i) for i in range(1, n - 1, 2)]
		odds += [str(3 * n // 2 - 1)]
		print('YES')
		print(' '.join(evens + odds))


for _ in '_' * int(input()):
	((n, k), a) = eval('[*map(int,input().split())],' * 2)
	c = [n] + [0] * k * 2
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		c[x] -= 1
		c[x + y - 1] -= 1
		c[x + y] += 1
		c[k + y] += 1
	for i in range(k * 2):
		c[i + 1] += c[i]
	print(min(c))


import os
import sys
from io import BytesIO, IOBase

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		L = list(map(int, input().split()))
		size = 2 * k + 1
		count = [0] * size
		ans = [0] * size
		(i, j) = (0, n - 1)
		while i < j:
			count[L[i] + L[j]] += 1
			i += 1
			j -= 1
		(i, j) = (0, n - 1)
		while i < j:
			(a, b) = (L[i], L[j])
			ans[min(a, b) + 1] += 1
			try:
				ans[max(a, b) + k + 1] -= 1
			except IndexError:
				pass
			i += 1
			j -= 1
		for i in range(2, size):
			ans[i] += ans[i - 1]
		for i in range(2, size):
			ans[i] -= count[i]
		for i in range(2, size):
			ans[i] += 2 * (n // 2 - (count[i] + ans[i]))
		print(min(ans[2:]))
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 = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	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().decode('ascii')

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

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


for i in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		k = n // 2
		for j in range(1, k + 1):
			print(2 * j, end=' ')
		for h in range(1, k):
			print(2 * h - 1, end=' ')
		print(3 * k - 1)


for __ in range(int(input())):
	n = int(input())
	if n // 2 & 1 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print(2 * (i + 1), end=' ')
		for i in range(n // 2):
			if i < n // 4:
				print(2 * (i + 1) - 1, end=' ')
			else:
				print(2 * (i + 1) + 1, end=' ')
		print('')


t = int(input())
a = []
it = 2
for i in range(10 ** 5):
	a.append(it)
	if i % 2:
		it += 4
	else:
		it += 2
b = [a[i] - 1 if not i % 2 else a[i] + 1 for i in range(10 ** 5)]
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(*a[:n // 2], *b[:n // 2])


t = int(input())
A = []
for i in range(t):
	x = int(input())
	A.append(x)
for i in range(len(A)):
	if A[i] % 4 == 0:
		l = A[i] // 2
		Ans1 = [2 * i + 2 for i in range(l)]
		s1 = 0
		s2 = 0
		for i in Ans1:
			s1 += i
		Ans2 = [2 * i + 1 for i in range(l - 1)]
		for j in Ans2:
			s2 += j
		Ans2.append(abs(s2 - s1))
		print('YES')
		print(*Ans1 + Ans2)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = n // 2
	if a % 2 == 1:
		print('NO')
	else:
		res = []
		for i in range(1, a + 1):
			res.append(i * 2)
		for i in range(1, a):
			res.append(2 * i - 1)
		s = sum(res[:a]) - sum(res[a:])
		res.append(s)
		print('YES')
		print(*res)


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2:
		print('NO')
		t -= 1
		continue
	ans = [i * 2 for i in range(1, n // 2 + 1)]
	for i in range(0, n // 2 - 1):
		ans.append(i * 2 + 1)
	print('YES')
	ans.append(n // 2 * (n // 2 + 1) - (n // 2 - 1) ** 2)
	print(' '.join((str(i) for i in ans)))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		a = 2
		c = 1
		k = 1
		diff = 0
		for i in range(n // 2):
			print(a, end=' ')
			if k == 1:
				k = 0
				diff = 2
			else:
				k = 1
				diff = 4
			a += diff
		diff = 0
		k = 1
		for i in range(n // 2):
			print(c, end=' ')
			if k == 0:
				k = 1
				diff = 2
			else:
				k = 0
				diff = 4
			c += diff
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		le = [(i + 1) * 2 for i in range(n // 2)]
		lo = [(i + 1) * 2 - 1 for i in range((n - 1) // 2)]
		lo.append(sum(le) - sum(lo))
		print('YES')
		print(*le, *lo)


t = int(input())

def odd():
	b = []
	for i in range(1, n - 1, 2):
		b.append(i)
	b.append(int(n + n / 2 - 1))
	return b

def ev():
	c = []
	for i in range(2, n + 1, 2):
		c.append(i)
	return c
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		ev()
		odd()
		print('YES')
		for f in ev() + odd():
			print(f, end=' ')


x = int(input())
for i in range(x):
	y = int(input())
	if y % 4 != 0:
		print('NO')
	else:
		z = []
		print('Yes')
		for j in range(y // 2):
			print((j + 1) * 2, end=' ')
			z.append((j + 1) * 2)
		for j in range(y // 4):
			print(z[j] - 1, end=' ')
		for j in range(y // 4, y // 2):
			print(z[j] + 1, end=' ')
		print()


import math
t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		t -= 1
		continue
	else:
		print('YES')
		ans = [0 for i in range(n)]
		val = 0
		for i in range(0, n // 2, 2):
			ans[i] = val + 4
			ans[i + 1] = val + 8
			ans[i + n // 2] = ans[i] - 1
			ans[i + 1 + n // 2] = ans[i + 1] + 1
			val = val + 8
		ans = ' '.join(map(str, ans))
		print(ans)
	t -= 1


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = 2
		s = 0
		for j in range(n // 2):
			print(a, end=' ')
			s = s + a
			a = a + 2
		s1 = 0
		a = 1
		for j in range(n // 2 - 1):
			print(a, end=' ')
			s1 = s1 + a
			a = a + 2
		print(s - s1)
	else:
		print('NO')


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
import sys
input = sys.stdin.readline
M = mod = 998244353

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().split()]

def st():
	return input()

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input()]

def li3():
	return [int(i) for i in input()]
for _ in range(val()):
	n = val()
	if n < 3 or n // 2 & 1:
		print('NO')
		continue
	print('YES')
	a = [i for i in range(40, n + 40, 2)]
	s = sum(a)
	b = [i for i in range(1, n - 1, 2)]
	b.append(s - sum(b))
	print(*a + list(b))


t = int(input())
import math
for _ in range(t):
	n = int(input())
	half = n // 2
	if half % 2 == 1:
		print('NO')
		continue
	evens = [2 * i for i in range(1, half + 1)]
	odds = [2 * i + 1 for i in range(0, half - 1)]
	odds = odds + [sum(evens) - sum(odds)]
	print('YES')
	print(' '.join([str(i) for i in evens] + [str(i) for i in odds]))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		last = n + n // 2 - 1
		print(' '.join(map(str, list(range(2, n + 1, 2)) + list(range(1, n - 2, 2)) + [last])))


def main():
	t = int(input())
	while t:
		n = int(input())
		li = [i * 2 for i in range(1, n // 2 + 1)]
		sum = 0
		for i in li:
			sum += i
		a = 1
		for i in range(n // 2):
			li.append(a)
			sum -= a
			a += 2
		if sum % 2 != 0:
			print('NO')
		else:
			print('YES')
			li[n - 1] += sum
			for i in li:
				print(i, end=' ')
			print()
		t -= 1
main()


for _ in range(int(input())):
	n = int(input())
	if int(n / 2) % 2 != 0:
		print('NO')
		continue
	else:
		a = []
		even = 2
		for i in range(int(n / 2)):
			a.append(even)
			even += 2
		sum1 = sum(a)
		odd = 1
		sum2 = 0
		for i in range(int(n / 2) - 1):
			a.append(odd)
			sum2 += odd
			odd += 2
		req = sum1 - sum2
		a.append(req)
		print('YES')
		print(*a)


import sys

def main():
	t = int(input())
	for _ in range(t):
		num = int(sys.stdin.readline().strip())
		if num % 4:
			print('NO')
		else:
			print('YES')
			sumVal = 0
			for i in range(num // 2):
				print((i + 1) * 2, end=' ')
				sumVal += (i + 1) * 2
			for i in range(num // 2 - 1):
				print((i + 1) * 2 - 1, end=' ')
				sumVal -= (i + 1) * 2 - 1
			print(sumVal)
	return
main()


for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print('NO')
	elif n % 4 != 0:
		print('NO')
	else:
		print('YES')
		even = [0] * (n // 2)
		odd = [0] * (n // 2)
		sum = 0
		for i in range(n // 2):
			even[i] = 2 * (i + 1)
			sum += even[i]
		s = 0
		for i in range(n // 2 - 1):
			odd[i] = 2 * i + 1
			s += odd[i]
		odd[i + 1] = sum - s
		for i in range(n // 2):
			print(even[i], end=' ')
		for i in range(n // 2):
			print(odd[i], end=' ')
		print()


def main():
	for _ in range(int(input())):
		n = int(input())
		k = n // 2
		l = [0] * k
		r = [0] * k
		if n == 2 or k % 2 != 0:
			print('NO')
		else:
			for i in range(k):
				l[i] = 2 * (i + 1)
				r[i] = 1 + 2 * i
			r[k - 1] = sum(l) - sum(r[:k - 1])
			l.extend(r)
			print('YES')
			for i in range(n):
				print(l[i], end=' ')
				if i == n - 1:
					print('')
main()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		arr = []
		for i in range(2, n + 1, 2):
			arr.append(i)
		for i in range(1, n, 2):
			arr.append(i)
		if sum(arr[:n // 2]) > sum(arr[n // 2:]):
			arr[n - 1] += sum(arr[:n // 2]) - sum(arr[n // 2:])
		print('YES')
		for j in range(n):
			if j == n - 1:
				print(arr[j])
			else:
				print(arr[j], end=' ')


t = int(input())
for q in range(t):
	n = int(input())
	m = n // 2
	if m % 2 == 0:
		a = [0] * n
		print('YES')
		w = 2
		for i in range(m // 2):
			a[i] = w
			a[i + m] = a[i] - 1
			w += 2
		for i in range(m // 2, m):
			a[i] = w
			a[i + m] = a[i] + 1
			w += 2
		for i in a:
			print(i, end=' ')
		print('')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	l1 = []
	l2 = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			l1.append(i)
		else:
			l2.append(i)
	l2[-1] += sum(l1) - sum(l2)
	print('YES')
	print(*l1 + l2)


numTest = int(input())

def test():
	n = int(input())
	if n % 4 != 0:
		print('No')
		return
	result = list(range(2, 2 * n // 2 + 1, 2)) + list(range(1, 2 * n // 2 + 1, 2))
	result[-1] += n // 2
	print('Yes')
	print(' '.join(list(map(str, result))))
for _ in range(0, numTest):
	test()


t = int(input())
for _ in range(t):
	c = 0
	d = 0
	e = 0
	a = int(input())
	b = a / 2
	if b % 2 != 0:
		print('NO')
	if b % 2 == 0:
		print('YES')
		for i in range(1, a // 2 + 1):
			c = c + 2 * 1
			e = e + c
			print(c, end=' ')
		for i in range(1, a // 2):
			print(2 * i - 1, end=' ')
			d = d + 2 * i - 1
		print(e - d)


import sys
input = sys.stdin.readline
import random, bisect
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())
d = defaultdict(int)
t = I()
for _ in range(t):
	n = I()
	l = []
	y = []
	if n // 2 % 2 == 0:
		for i in range(0, n, 2):
			if i // 2 % 2 == 0:
				l.append((i + 4) * 2)
				y.append((i + 4) * 2 + 1)
			else:
				l.append((i + 4) * 2)
				y.append((i + 4) * 2 - 1)
		print('YES')
		print(*l, end=' ')
		print(*y, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for a in range(t):
	(n, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	lookUp = dict()
	sumMinMax = []
	values = [0 for c in range(2 * k + 2)]
	for b in range(n // 2):
		pairSum = nums[b] + nums[n - b - 1]
		if pairSum in lookUp:
			lookUp[pairSum] += 1
		else:
			lookUp[pairSum] = 1
		sumMinMax.append([pairSum, 1 + min(nums[b], nums[n - b - 1]), k + max(nums[b], nums[n - b - 1])])
		values[1 + min(nums[b], nums[n - b - 1])] += 1
		values[k + max(nums[b], nums[n - b - 1]) + 1] -= 1
	sumPrevious = 0
	for c in range(len(values)):
		values[c] += sumPrevious
		sumPrevious = values[c]
	best = 0
	for key in lookUp:
		actual = lookUp[key] - (n // 2 - values[key])
		if actual > best:
			best = actual
	print(n // 2 - best)


t = int(input())
for i in range(t):
	n = int(input())
	p = n // 2
	if p & 1:
		print('NO')
	else:
		print('YES')
		(a, b) = (0, 0)
		l = []
		i = 2
		for j in range(n // 2):
			a += i
			print(i, end=' ')
			i += 2
		i = 1
		for j in range(n // 2 - 1):
			b += i
			print(i, end=' ')
			i += 2
		print(a - b)


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()
t = iint()
for _x in range(t):
	n = iint()
	if n % 4:
		print('NO')
	else:
		(left, right) = ([], [])
		for i in range(2, n + 1, 2):
			left.append(i)
		for i in range(1, n + 1, 2):
			right.append(i)
		right[-1] += n // 2
		print('YES')
		print(*left, *right, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		a = []
		m = 1
		s1 = 0
		s2 = 0
		for i in range(n // 2):
			a.append((i + 1) * 2)
			s1 += a[i]
		for i in range(n // 2, n - 1):
			a.append(m)
			m += 2
			s2 += a[i]
		a.append(s1 - s2)
		print(*a)


T = int(input())
p = [0] * 400005
cnt = [0] * 400005
while T != 0:
	ans = 2 ** 30
	T -= 1
	(n, k) = map(int, input().split())
	for i in range(0, k * 2 + 1):
		p[i] = cnt[i] = 0
	a = list(map(int, input().split()))
	a = [0] + a
	for i in range(1, n // 2 + 1):
		cnt[a[i] + a[n - i + 1]] += 1
		l = min(a[i], a[n - i + 1]) + 1
		r = max(a[i], a[n - i + 1]) + k
		p[l] += 1
		p[r + 1] -= 1
	for i in range(1, k * 2 + 1):
		p[i] += p[i - 1]
	for i in range(2, k * 2 + 1):
		u = cnt[i]
		v = p[i] - u
		w = n // 2 - p[i]
		ans = min(ans, w * 2 + v)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for j in range(1, x + 1):
			a.append(j * 2)
		for j in range(1, x):
			a.append(j * 2 - 1)
		g = a[x - 1] + x - 1
		a.append(g)
		a = map(str, a)
		print(' '.join(a))


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 12

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, b):
	for i in range(26):
		for j in range(len(a) + 1):
			q = a[:j] + chr(97 + i) + a[j:]
			if q == b:
				return 1
	return 0

def solve(a):
	n = a // 2
	if n & 1:
		print('NO')
	else:
		p = [2]
		z = 2
		for i in range(n - 1):
			z = z + 4
			p.append(z)
		q = p.copy()
		for i in range(0, len(q) - 1, 2):
			q[i] = q[i] - 1
			q[i + 1] = q[i + 1] + 1
		print('YES')
		print(*p, end=' ')
		print(*q)
for _ in range(inp()):
	a = inp()
	l = solve(a)


for _ in range(int(input())):
	e = []
	o = []
	f = 1
	n = int(input())
	for i in range(1, n // 2 + 1):
		x = 2 * i
		e.append(x)
	for i in range(1, n // 2):
		x = 2 * i - 1
		o.append(x)
	if (e[n // 2 - 1] + n // 2 - 1) % 2 != 1:
		f = 0
		print('NO')
	if f:
		o.append(e[n // 2 - 1] + n // 2 - 1)
		print('YES')
		for i in range(n // 2):
			print(e[i], end=' ')
		for i in range(n // 2):
			print(o[i], end=' ')
		print()


ntest = int(input())
lista = []
for i in range(ntest):
	a = input()
	a = int(a)
	if a % 4 != 0:
		lista.append('NO')
	else:
		lista.append('YES')
		pair = [i for i in range(2, a + 1, 2)]
		odd = [j - 1 for j in range(2, a + 1, 2)]
		n = a // 4
		for i in range(n):
			odd[n + i] = odd[n + i] + 2
		lista_str = ' '.join((str(i) for i in pair + odd))
		lista.append(lista_str)
for i in range(len(lista)):
	print(lista[i])


t = int(input())
while t:
	n = int(input())
	arr = []
	j = 2
	s = 0
	s2 = 0
	for i in range(n // 2):
		arr.append(j)
		s += j
		j += 2
	j = 1
	for i in range(n // 2 - 1):
		arr.append(j)
		s2 += j
		j += 2
	flag = 0
	if s - s2 > arr[n - 2] and (s - s2) % 2 == 1:
		arr.append(s - s2)
		flag = 1
	if flag == 1:
		print('YES')
		print(*arr)
	else:
		print('NO')
	t -= 1


def printer(n):
	lis = []
	for i in range(3, 4 + 6 * (n - 1), 6):
		lis.extend([i - 1, i + 1])
	for i in range(3, 4 + 6 * (n - 1), 6):
		lis.extend([i - 2, i + 2])
	print(' '.join(list(map(str, lis))))
for _ in range(int(input())):
	num = int(input())
	if num % 4 == 0:
		print('YES')
		printer(num // 4)
		continue
	print('NO')


def solve(n):
	answer = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			answer.append(2 * i)
		for i in range(1, n // 2 + 1):
			answer.append(2 * i - 1)
		answer[n - 1] += n // 2
		print(' '.join(map(str, answer)))
	return
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	result = solve(n)


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

def cino(test=False):
	if not test:
		return int(input())
	else:
		return input()

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

def ssplit():
	return list(input().split())

def printlist(l):
	for i in l:
		print(i, end=' ')
n = cino()
for _ in range(n):
	a = cino()
	if a // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		(sumi, sumi2) = (0, 0)
		for i in range(2, a + 1, 2):
			print(i, end=' ')
			sumi += i
		cnt = 1
		for i in range(a // 2 - 1):
			print(i + cnt, end=' ')
			sumi2 += i + cnt
			cnt += 1
		print(sumi - sumi2)


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		even = [i for i in range(2, n + 1, 2)]
		odd = [i - 1 for i in even]
		odd[-1] += int(n / 2)
		arr = even + odd
		print('YES')
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [*range(2, n + 1, 2)]
	b = [*range(1, n, 2)]
	b[-1] += n // 2
	print(['YES\n' + ' '.join(map(str, a + b)), 'NO'][n % 4 > 0])


a = int(input())
even = []
odd = []
for j in range(1, 200001):
	if j % 2 == 0:
		even.append(j)
	else:
		odd.append(j)
for i in range(a):
	n = int(input())
	ans = []
	c0 = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		for j in range(int(n / 2)):
			ans.append(even[j])
		z = sum(ans)
		for k in range(int(n / 2) - 1):
			ans.append(odd[k])
			c0.append(odd[k])
		y = sum(c0)
		w = z - y
		ans.append(w)
		print('YES')
	for l in ans:
		print(l, end=' ')


T = int(input())
for t in range(T):
	n = int(input())
	arr = list()
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			arr.append(str(i))
		for i in range(1, n, 2):
			arr.append(str(i))
		arr[-1] = int(arr[-1]) + n // 2
		arr[-1] = str(arr[-1])
		print(' '.join(arr))


from collections import defaultdict
for ii in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	evt = [0] * (2 * k + 2)
	for i in range(n // 2):
		mi = min(arr[i], arr[n - i - 1])
		ma = max(arr[i], arr[n - i - 1])
		evt[1] += 2
		evt[mi + 1] -= 1
		evt[mi + ma] -= 1
		evt[mi + ma + 1] += 1
		evt[ma + k + 1] += 1
	ans = n
	s = 0
	for i in evt[1:]:
		s += i
		ans = min(ans, s)
	print(ans)


t = int(input())
for z in range(t):
	n = int(input())
	res = []
	for par in range(2, n + 1, 2):
		res.append(par)
	suma_par = sum(res)
	for impar in range(1, n, 2):
		res.append(impar)
	res = res[:-1]
	last = suma_par * 2 - sum(res)
	if last % 2 == 1:
		print('YES')
		for i in res:
			print('%s ' % i, end='')
		print(last)
	else:
		print('NO')


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 collections
import bisect
for j in range(int(input())):
	(n, k) = map(int, input().split())
	vals = list(map(int, input().split()))
	dict1 = collections.defaultdict(int)
	maxy = []
	miny = []
	for s in range(n // 2):
		max1 = max(vals[s], vals[-1 - s]) + k
		min1 = min(vals[s], vals[-1 - s]) + 1
		sum1 = vals[s] + vals[-1 - s]
		dict1[sum1] += 1
		maxy.append(max1)
		miny.append(min1)
	moves = n // 2
	maxy.sort()
	miny.sort()
	for s in dict1.keys():
		reps = dict1[s]
		a1 = bisect.bisect_left(miny, s + 1)
		a2 = bisect.bisect_left(maxy, s)
		reps -= max(len(miny) - a1, a2)
		m1 = n // 2 - reps
		if m1 < moves:
			moves = m1
	print(moves)


T = int(input())
while T:
	n = int(input())
	F = 'YES'
	k = n // 2
	if k % 2 != 0:
		F = 'NO'
		print(F)
	else:
		A = [0 for i in range(n)]
		for i in range(k):
			A[i] = (i + 1) * 2
		for i in range(k, n - 1):
			A[i] = (i - k) * 2 + 1
		L = sum(A[:k])
		R = sum(A[k:n])
		A[n - 1] = L - R
		print(F)
		print(*A)
	T = T - 1


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		odds = [1]
		eves = [2]
		n = n // 2
		while n > 1:
			n -= 1
			eves.append(eves[len(eves) - 1] + 2)
			odds.append(odds[len(odds) - 1] + 2)
		odds[len(odds) - 1] = 0
		odds[len(odds) - 1] = sum(eves) - sum(odds)
		odds = [str(x) for x in odds]
		eves = [str(x) for x in eves]
		print(' '.join(eves) + ' ' + ' '.join(odds))
	else:
		print('NO')


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	L = list(map(int, input().split()))
	prefix = [0] * (2 * K + 2)
	prefix[1] = N
	for i in range(N // 2):
		(x, y) = sorted((L[i], L[N - i - 1]))
		prefix[x + 1] -= 1
		prefix[x + y] -= 1
		prefix[x + y + 1] += 1
		prefix[y + K + 1] += 1
	for i in range(1, 2 * K + 2):
		prefix[i] += prefix[i - 1]
	print(min(prefix[1:]))


def scanf():
	return list(map(int, input().split()))
for t in range(int(input())):
	(n, k) = scanf()
	a = [0] + scanf()
	m = [0 for i in range(2 * k + 2)]
	m[1] = n
	for i in range(1, n // 2 + 1):
		p = min(a[i], a[n - i + 1])
		q = max(a[i], a[n - i + 1])
		m[p + 1] -= 1
		m[p + q] -= 1
		m[p + q + 1] += 1
		m[q + k + 1] += 1
	ans = 9e+18
	D = m[1]
	for mit in m[2:]:
		D += mit
		ans = min(ans, D)
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	if n == 0 or n // 2 % 2 != 0:
		print('NO')
	else:
		a = [i * 2 for i in range(1, n // 2 + 1)]
		b = [i * 2 for i in range(1, n // 2 + 1)]
		for i in range(0, len(a)):
			if i >= len(a) // 2:
				b[i] = b[i] + 1
			else:
				b[i] = b[i] - 1
		print('YES')
		print(*a + b)
	t -= 1


def findMaxGuests(arrl, exit, n):
	arrl.sort()
	exit.sort()
	guests_in = 1
	max_guests = 1
	time = arrl[0]
	i = 1
	j = 0
	while i < n and j < n:
		if arrl[i] <= exit[j]:
			guests_in = guests_in + 1
			if guests_in > max_guests:
				max_guests = guests_in
				time = arrl[i]
			i = i + 1
		else:
			guests_in = guests_in - 1
			j = j + 1
	return max_guests
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	start = []
	end = []
	for i in range(n // 2):
		start.append(min(ar[i], ar[i * -1 - 1]) + 1)
		end.append(max(ar[i], ar[i * -1 - 1]) + k)
		start.append(ar[i] + ar[i * -1 - 1])
		end.append(ar[i] + ar[i * -1 - 1])
	print(n - findMaxGuests(start, end, len(start)))


for _ in range(int(input())):
	a = int(input())
	if a // 2 % 2 != 0:
		print('NO')
	else:
		ar1 = []
		ar2 = []
		for i in range(2, a + 1, 2):
			ar1.append(i)
		for i in range(1, a - 1, 2):
			ar2.append(i)
		ar2.append(sum(ar1) - sum(ar2))
		ar = ar1 + ar2
		print('YES')
		print(*ar)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	else:
		ans = []
		for i in range(n // 2):
			ans.append(2 * (1 + i))
		cnt = 0
		for i in range(n // 2):
			if i <= n // 2 // 2 - 1:
				ans.append(ans[i] - 1)
			else:
				ans.append(ans[i] + 1)
	print('YES')
	print(*ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 is not 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			(print(i * 2, sep=' ', end=' '),)
		for i in range(0, n // 2 - 1):
			(print(i * 2 + 1, sep=' ', end=' '),)
		print(n + 2 * (n // 4 - 1) + 1)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		a = [i for i in range(2, n + 1, 2)]
		b = [i for i in range(1, n + 1, 2)]
		b[-1] += n // 2
		print('YES')
		print(*a, *b)


for s in [*open(0)][1:]:
	n = int(s)
	print(*(n % 4 and ['NO'] or ['YES'] + [*range(2, n + 1, 2)] + [n + n // 2 - 1] + [*range(1, n - 1, 2)]))


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	(n, k) = [int(x) for x in input().strip().split()]
	a = [int(x) for x in input().strip().split()]
	(s, e, h) = ([0] * (2 * k + 1), [0] * (2 * k + 1), [0] * (2 * k + 1))
	for ai in range(n // 2):
		(fi, se) = (a[ai], a[n - ai - 1])
		h[fi + se] += 1
		s[min(fi, se) + 1] += 1
		e[max(fi, se) + k] += 1
	(ans, ss) = (n // 2, 0)
	for i in range(2, 2 * k + 1):
		ss += s[i]
		ta = 0
		ta += ss - h[i]
		ta += 2 * (n // 2 - ss)
		ss -= e[i]
		ans = min(ans, ta)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	a = []
	a = [i for i in range(2, n + 1, 2)]
	for i in range(1, n - 1, 2):
		a.append(i)
	a.append(i + 2 + n // 2)
	print('YES')
	for i in range(len(a)):
		print(a[i], end=' ')
	print()


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = [(i + 1) * 2 for i in range(n // 2)]
		temp = sum(ans)
		odd = 1
		for i in range(n // 2):
			if i == n // 2 - 1:
				ans.append(temp)
				break
			temp -= odd
			ans.append(odd)
			odd += 2
		for i in ans:
			print(i, end=' ')
		print()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	array = list(map(int, sys.stdin.readline().split()))
	out = 10 ** 9
	maxs = list()
	mins = list()
	somme = [0] * (2 * k + 1)
	maxi = 0
	for i in range(n // 2):
		s = array[i] + array[n - i - 1]
		somme[s] += 1
		maxs.append(s - min(array[i], array[n - i - 1]) + k)
		mins.append(s - max(array[i], array[n - i - 1]) + 1)
	maxs.sort()
	mins.sort()
	imax = 0
	imin = 0
	lenmin = len(mins)
	lenmax = len(maxs)
	for i in range(2, 2 * k + 1):
		while imax != lenmax and i > maxs[imax]:
			imax += 1
		while imin != lenmin and i >= mins[imin]:
			imin += 1
		double = lenmin - imin + imax
		total = n // 2 - somme[i] - double + 2 * double
		out = min(out, total)
	print(out)


for i in range(int(input())):
	n = int(input())
	a = []
	b = []
	sum2 = 0
	sum1 = 0
	t = 1
	if n % 2 == 0 and n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				print(i, end=' ')
				a.append(i)
		for i in range(1, n // 2):
			print(t, end=' ')
			b.append(t)
			t = t + 2
		print(sum(a) - sum(b))


t = int(input())
for test in range(t):
	n = int(input())
	if n / 2 % 2:
		print('NO')
	else:
		a = []
		b = []
		i = 1
		for count in range(n // 4):
			b.append(2 * i - 1)
			i += 1
		i -= 1
		for count in range(n // 2):
			a.append(2 * i)
			i += 1
		i -= 1
		for count in range(n // 4):
			b.append(2 * i + 1)
			i += 1
		a += b
		print('YES')
		print(' '.join((str(elem) for elem in a)))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = []
		b = 2
		for i in range(n // 2):
			a.append(b)
			b = b + 2
		for i in range(n // 4):
			a.append(a[i] - 1)
		for i in range(n // 4):
			a.append(a[n // 4 + i] + 1)
		print(*a)
	else:
		print('NO')


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

def main():
	for _ in range(ii()):
		n = ii()
		a = n // 2
		if a % 2:
			print('NO')
			continue
		l = []
		for i in range(1, a + 1):
			l.append(2 * i)
		a = sum(l)
		s = 0
		for i in range(1, n - 1, 2):
			s += i
			l.append(i)
		l.append(a - s)
		print('YES')
		print(*l)
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()


for _ in range(int(input())):
	n = int(input())
	a = [i for i in range(2, n + 1, 2)]
	b = [i for i in range(1, n - 2, 2)]
	c = [*a, *b]
	x = n + n // 2 - 1
	if n // 2 % 2 == 0:
		print('YES')
		c.append(x)
		for i in range(n):
			print(c[i], end=' ')
		print()
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	d = []
	x = 2
	y = 1
	xx = 0
	yy = 0
	m = n // 2
	if n / 2 % 2 == 1:
		print('NO')
	else:
		while m > 0:
			d.append(x)
			xx += x
			x += 2
			m -= 1
		m = n // 2
		while m - 1 > 0:
			d.append(y)
			yy += y
			y += 2
			m -= 1
		d.append(xx - yy)
		print('YES')
		print(*d)


for t in range(int(input().strip())):
	n = int(input().strip())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		nh = n // 2
		res1 = []
		res2 = []
		for i in range(1, nh + 1):
			res1.append(str(2 * i))
			res2.append(str(2 * i - 1))
		res2[-1] = str(3 * nh - 1)
		print(' '.join(res1 + res2))


total = int(input())
for _ in range(total):
	n = list(map(int, input().split()))[0]
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		A = [str(x) for x in range(2, n + 1, 2)] + [str(x) for x in range(1, n - 1, 2)] + [str((3 * n - 2) // 2)]
		print(' '.join(A))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		arr = []
		j = 2
		for i in range(n // 2):
			arr.append(j)
			j += 2
		mx = arr[-1]
		j = 1
		for i in range(n // 2 - 1):
			arr.append(j)
			j += 2
		arr.append(mx + n // 2 - 1)
		print('YES')
		for i in arr:
			print(i, end=' ')
		print()


t = int(input())
for a0 in range(t):
	e1 = []
	o1 = []

	def out(n):
		if n % 2 == 0:
			if n // 2 % 2 == 0:
				odd = 0
				even = 0
				for i in range(1, n + 1):
					if i % 2 == 0:
						e1.append(i)
						even += i
					else:
						o1.append(i)
						odd += i
				if odd != even:
					if odd > even:
						e1[len(e1) - 1] += abs(odd - even)
					else:
						o1[len(o1) - 1] += abs(odd - even)
				return 'YES'
			else:
				return 'NO'
		else:
			return 'NO'
	n = int(input())
	res = out(n)
	if res == 'YES':
		print(res)
		print()
		for c in e1:
			print(c, end=' ')
		for c in o1:
			print(c, end=' ')
	else:
		print(res)
	print()


t = int(input())
while t > 0:
	ans = []
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		t -= 1
		continue
	else:
		print('YES')
	fh = int(n / 2)
	for i in range(1, fh + 1):
		ans.append(i * 2)
	fh_ = 0
	for total in ans:
		fh_ += total
	sh_ = 0
	for i in range(0, fh):
		if i == fh - 1:
			ans.append(fh_ - sh_)
		else:
			sh_ += 1 + 2 * i
			ans.append(1 + 2 * i)
	print(*ans)
	t -= 1


t = int(input())
n = [int(input()) for _ in range(t)]
for ni in n:
	if ni % 4 != 0:
		print('NO')
	else:
		print('YES')
		a1 = [2 * i for i in range(1, int(ni / 2) + 1)]
		a2 = [2 * i - 1 for i in range(1, int(ni / 2))]
		a2.append(sum(a1) - sum(a2))
		a1.extend(a2)
		print(*a1)


from collections import Counter
import bisect
n_cases = int(input())
for case_num in range(n_cases):
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	m = n // 2
	maxes = []
	mins = []
	ctr = Counter()
	for i in range(n // 2):
		x = arr[i]
		y = arr[n - i - 1]
		maxes.append(max(x, y) + k)
		mins.append(min(x, y) + 1)
		ctr[x + y] += 1
	maxes = sorted(maxes)
	mins = sorted(mins)
	best = 2 ** 30
	for s in range(2, 2 * k + 1):
		cnt = ctr[s]
		n_max_bad = bisect.bisect_left(maxes, s)
		n_min_bad = m - bisect.bisect_right(mins, s)
		cost = m - cnt + n_max_bad + n_min_bad
		best = min(best, cost)
	print(best)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

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

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve(x):
	if x & 2:
		print('NO')
		return
	print('YES')
	ans = []
	tmp = 0
	for i in range(2, x + 1, 2):
		ans.append(i)
		tmp += i
	for i in range(1, x - 1, 2):
		ans.append(i)
		tmp -= i
	ans.append(tmp)
	print(*ans)
	return
for _ in range(II()):
	solve(II())


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		k = n // 4 * 6
		print(*range(2, k + 1, 6), *range(4, k + 1, 6), *range(1, k + 1, 6), *range(5, k + 1, 6))


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


def f(n):
	x = n // 2
	if x % 2 == 1:
		return False
	else:
		m = x * (x + 1) - (x - 1) ** 2
		if m % 2 == 1:
			A = [2 * k for k in range(1, x + 1)]
			for i in range(1, x):
				A += [2 * i - 1]
			A += [m]
			return A
		else:
			return False
t = int(input())
ans = []
for i in range(t):
	x = int(input())
	if f(x) == False:
		ans += ['NO']
	else:
		ans += [f(x)]
for j in ans:
	if j == 'NO':
		print('No')
	else:
		print('YES')
		for n in j:
			print(n, end=' ')
		print()


number_of_tests = int(input())
for i in range(number_of_tests):
	number = int(input())
	if number // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		sum1 = 0
		sum2 = 0
		for j in range(1, number // 2 + 1):
			print(j * 2, end=' ')
			sum1 += j * 2
		for j in range(1, number // 2):
			print(j * 2 - 1, end=' ')
			sum2 += j * 2 - 1
		print(sum1 - sum2)


for _ in range(int(input())):
	d = []
	c = []
	a = int(input())
	if a // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(2, a + 1, 2):
			d.append(i)
		s = sum(d)
		for i in range(1, a - 1, 2):
			c.append(i)
		c.append(s - sum(c))
		print(*d + c)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 4 == 0:
		print('YES')
		even = [2 * k for k in range(1, int(a / 2 + 1))]
		odd = [2 * k - 1 for k in range(1, int(a / 2 - 1) + 1)]
		odd.append(int(1.5 * a - 1))
		output = even + odd
		for item in output:
			print(item, end=' ')
		print('')
	else:
		print('NO')


def ba(n):
	if n % 4 == 0:
		l = []
		for i in range(2, n + 1, 2):
			l.append(i)
		for i in range(1, n, 2):
			l.append(i)
		l[len(l) - 1] = l[len(l) - 1] + int(n / 2)
		print('yes')
		print(*l, sep=' ')
	else:
		print('no')
	return
t = int(input())
for i in range(t):
	T = int(input())
	ba(T)


a = int(input())
for i in range(a):
	b = int(input())
	if b / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(2, b + 1, 2):
			print(j, end=' ')
		for k in range(1, b // 2):
			print(2 * k - 1, end=' ')
		print(k + j)


for _ in range(int(input())):
	n = int(input())
	a = []
	b = []
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			a.append(i)
		s = sum(a)
		ans = n // 2 - 1
		for j in range(1, ans * 2, 2):
			a.append(j)
			b.append(j)
		sy = sum(b)
		a.append(s - sy)
		print(*a)


T = int(input())
for _ in range(T):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	print('Yes')
	ans_odd = {}
	ans_even = {}
	even = 1
	for i in range(1, int(n / 2) + 1, 2):
		(first, second) = (2 * i, 2 * (i + 1))
		ans_odd[first] = 1
		ans_odd[second] = 1
		s = first + second
		while True:
			if even not in ans_even and s - even not in ans_even:
				ans_even[even] = 1
				ans_even[s - even] = 1
				break
			even += 2
	print(' '.join([str(x) for x in sorted(list(ans_odd.keys())) + sorted(list(ans_even.keys()))]))


for i in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	arr = [int(i) for i in input().split()]
	d = {}
	na = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		d[arr[i] + arr[-1 - i]] = d.get(arr[i] + arr[-1 - i], 0) + 1
		na[max(arr[i], arr[-1 - i]) + k + 1] += -1
		na[min(arr[i], arr[-1 - i]) + 1] += 1
	for i in range(1, 2 * k + 2):
		na[i] += na[i - 1]
	key = list(d.keys())
	ans = n
	for i in key:
		ans = min(ans, na[i] + (n // 2 - na[i]) * 2 - d[i])
	print(min(ans, max(na) + (n // 2 - max(na)) * 2))


t = int(input())
p = ''
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		p += 'NO\n'
	else:
		p += 'YES\n'
		res = [i * 2 for i in range(1, n // 2 + 1)]
		tmp = sum(res)
		count = n // 2 - 1
		for i in range(1, n + 1, 2):
			if count <= 0:
				break
			tmp -= i
			res.append(i)
			count -= 1
		res.append(tmp)
		p += ' '.join(list(map(str, res)))
		p += '\n'
print(p)


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		print('Yes')
		for j in range(2, n + 2, 2):
			if j == n:
				per = j
			print(j, end=' ')
		for j in range(1, n, 2):
			if j == n - 1:
				print(per + n // 2 - 1)
				break
			print(j, end=' ')
	else:
		print('No')


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		sum_even = 0
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
			sum_even += i * 2
		sum_odd = 0
		for i in range(1, n // 2):
			print(i * 2 - 1, end=' ')
			sum_odd += i * 2 - 1
		print(sum_even - sum_odd)


import sys
t = int(input())
ans = []
for line in sys.stdin.readlines():
	n = int(line)
	if n % 4 != 0:
		ans.append('NO\n')
		continue
	result = list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [n + n // 2 - 1]
	ans.append('YES\n')
	ans.append(' '.join(map(str, result)) + '\n')
print(''.join(ans))


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	a = []
	s = 0
	for i in range(n // 2):
		s += 2 * (i + 1)
		a.append(2 * (i + 1))
	for j in range(n // 2 - 1):
		s -= 2 * j + 1
		a.append(2 * j + 1)
	a.append(s)
	print('YES')
	print(*a)


t = int(input())
while t:
	n = int(input())
	half = n // 2
	even = half // 2 * (2 * 2 + (half - 1) * 2)
	odd = (half - 1) ** 2
	leftover = even - odd
	if leftover % 2 == 1 and even == odd + leftover:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 2, 2):
			print(i, end=' ')
		print(leftover, end=' ')
	else:
		print('NO', end=' ')
	print('\n')
	t -= 1


def main():
	for tin in range(int(input())):
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			a = []
			for _ in range(2, n + 1, 2):
				a.append(_)
			a = a[:n // 2 + 1]
			b = []
			for _ in range(1, n, 2):
				b.append(_)
			b = b[:n // 2 + 1]
			b[-1] = b[-1] + n // 2
			c = list(a + b)
			print('YES')
			print(*c)
main()


t = int(input())
for t1 in range(0, t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		l = []
		l1 = []
		x = 2
		y = 1
		for i in range(0, n // 2 - 1):
			l.append(x)
			l1.append(y)
			x = x + 2
			y = y + 2
		l.append(x)
		l1.append(sum(l) - sum(l1))
		l = l + l1
		print(*l)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = list(range(2, n + 1, 2)) + list(range(1, n + 1, 2))
		l[-1] += n // 2
		print(*l)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	n = n / 2
	if n % 2 != 0:
		print('NO')
	else:
		n = int(n)
		print('YES')
		a = []
		b = []
		for i in range(1, n + 1):
			a.append(2 * i)
		for i in range(1, n):
			b.append(2 * i - 1)
		b.append(sum(a) - sum(b))
		a.extend(b)
		print(*a)


t = int(input())
for q in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		start = 2 * int(n / 4)
		a = [0] * n
		end = 1
		for i in range(int(n / 2)):
			a[i] = start
			start += 2
		for i in range(int(n / 2), int(3 * n / 4)):
			a[i] = end
			end += 2
		end = a[int(n / 2) - 1] + 1
		for i in range(int(3 * n / 4), n):
			a[i] = end
			end += 2
		y = ''
		for i in a:
			y += str(i)
			y += ' '
		print(y)


n = int(input())
for i in range(n):
	x = int(input())
	a = []
	r = True
	for i in range(1, x + 1):
		if i % 2 == 0:
			a.append(i)
	for i in range(1, x):
		if i % 2 == 1:
			a.append(i)
	if sum(a[:int(len(a) / 2)]) != sum(a[int(len(a) / 2):]):
		a[-1] += sum(a[:int(len(a) / 2)]) - sum(a[int(len(a) / 2):])
	for i in range(len(a) // 2, len(a) + 1):
		if a[-1] % 2 == 0:
			print('NO')
			r = False
			break
	if r:
		print('YES')
		print(*a, sep=' ')


from sys import stdin
import sys
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n % 4 != 0:
		print('NO')
	else:
		arr = [2 * i for i in range(1, n // 2 + 1)] + [2 * i + 1 for i in range(n // 2)]
		arr[-1] += n // 2
		arr = ' '.join(map(str, arr))
		print('YES')
		print(arr)


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	for i in range(2, n + 1, 2):
		print(i, end=' ')
	for i in range(1, n - 1, 2):
		print(i, end=' ')
	print(i + n // 2 + 2)
for __ in range(int(input())):
	solve()


MOD = 10 ** 9 + 7

def main():
	for _ in inputt():
		(n,) = inputi()
		if n % 4:
			print('NO')
		else:
			print('YES')
			for i in range(2, n + 1, 2):
				print(i, end=' ')
			for i in range(1, n - 1, 2):
				print(i, end=' ')
			print(n // 2 * 3 - 1)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.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(io.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):
	sys.stdout.write(kwargs.pop('split', ' ').join(map(str, args)))
	sys.stdout.write(kwargs.pop('end', '\n'))
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda : map(int, inputs())
inputl = lambda t=0, k=inputi: map(list, (k() for _ in range(t))) if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError
main()


a = int(input())
for i in range(a):
	b = int(input())
	c = b // 2
	if c % 2 != 0:
		print('NO')
	else:
		arr = []
		even = 2
		sume = 0
		sumo = 0
		odd = 1
		for j in range(c):
			sume += even
			arr.append(even)
			even += 2
		for j in range(c - 1):
			sumo += odd
			arr.append(odd)
			odd += 2
		arr.append(sume - sumo)
		print('YES')
		for j in arr:
			print(j, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	count = n // 2
	if count % 2 == 1:
		print('NO')
	else:
		print('YES')
		j = 2
		for i in range(count):
			print(j, end=' ')
			j += 2
		x = count * (count + 1)
		j = 1
		for i in range(count - 1):
			print(j, end=' ')
			j += 2
		y = (count - 1) ** 2
		print(x - y)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	data = list(map(int, input().split()))
	in_map = {}
	out_map = {}
	temp_map = {}
	from_0 = set()
	for i in range(n // 2):
		min_value = min(data[i], data[n - i - 1])
		max_value = max(data[i], data[n - i - 1])
		lower_bound = min_value + 1
		higher_bound = max_value + k
		now_sum = min_value + max_value
		if lower_bound in in_map:
			in_map[lower_bound] += 1
		else:
			in_map[lower_bound] = 1
		if higher_bound in out_map:
			out_map[higher_bound] -= 1
		else:
			out_map[higher_bound] = -1
		if now_sum in temp_map:
			temp_map[now_sum] += 1
		else:
			temp_map[now_sum] = 1
		from_0.add(lower_bound)
		from_0.add(higher_bound)
		from_0.add(now_sum)
	sorted_set = sorted(from_0)
	my_sum = 0
	result = n
	for i in sorted_set:
		a = 0
		if i in in_map:
			a = in_map[i]
		my_sum += a
		t = 0
		if i in temp_map:
			t = temp_map[i]
		now_total = n - (my_sum + t)
		result = min(result, now_total)
		b = 0
		if i in out_map:
			b = out_map[i]
		my_sum += b
	print(result)


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		s = sum(range(2, n + 1, 2))
		nds = sum(range(1, n - 2, 2))
		print(*range(2, n + 1, 2), *range(1, n - 2, 2), s - nds)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	b = []
	x = 1
	y = 2
	for i in range(n // 2):
		b.append(y)
		if i == n // 2 - 1 and (sum(b) - sum(a)) % 2 == 1:
			a.append(sum(b) - sum(a))
		else:
			a.append(x)
		x += 2
		y += 2
	if sum(a) == sum(b):
		print('YES')
		print(*b, *a)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		e = []
		o = []
		print('YES')
		c = 2
		for i in range(n // 2):
			e.append(c)
			print(c, end=' ')
			c += 2
		c = 1
		for i in range(n // 2 - 1):
			o.append(c)
			print(c, end=' ')
			c += 2
		se = sum(e)
		so = sum(o)
		print(se - so)


def findDistinctOddsumm(n, k):
	if k * k <= n and (n + k) % 2 == 0:
		val = 1
		summ = 0
		for i in range(1, k):
			print(val, end=' ')
			summ += val
			val += 2
		print(n - summ, end=' ')
t = int(input())
for _ in range(t):
	n = int(input())
	N = n // 2
	even_sum = N * (N + 1)
	if N * N <= even_sum and (even_sum + N) % 2 == 0:
		print('YES')
		index = 2
		for i in range(n // 2):
			print(2 * index - 2, end=' ')
			index += 1
		findDistinctOddsumm(even_sum, N)
		print()
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 2 or n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		v = 2
		l = n // 2
		while l > 0:
			print(v, end=' ')
			v += 2
			l -= 1
		l = n // 2
		v = 1
		while l > 1:
			print(v, end=' ')
			v += 2
			l -= 1
		l = n // 2
		print(n + l - 1)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('\nNO')
	else:
		print('YES')
		c = int(3 * n / 2)
		a = []
		b = []
		for i in range(c):
			if i % 2 == 0:
				a.append(i)
			else:
				b.append(i)
		b[int(n / 2 - 1)] += int(n / 2)
		lst = a[1:int(n / 2 + 1)] + b[:int(n / 2)]
		for i in lst:
			print(i, end=' ')


n = int(input())
for i in range(n):
	num = int(input())
	if num % 4 == 0:
		print('YES')
		my_list = []
		evens = []
		odds = []
		for m in range(1, num // 2 + 1):
			evens.append(m * 2)
		for l in range(1, num // 2):
			odds.append(l * 2 - 1)
		current_sum = sum(odds)
		odds.append(sum(evens) - current_sum)
		print(*evens + odds)
	else:
		print('NO')


n1 = int(input())
for i in range(n1):
	n = int(input())
	li = []
	a = []
	b = []
	if n % 4 != 0:
		print('No')
	else:
		for i in range(1, n // 2 + 1):
			li.append(2 * i)
			a.append(2 * i)
		for i in range(1, n // 2):
			li.append(2 * i - 1)
			b.append(2 * i - 1)
		li.append(sum(a) - sum(b))
		print('Yes')
		print(*li)


l = [0 for i in range(2 * 10 ** 5)]
sol = []
s = 6
j = 0
for i in range(10 ** 5 // 2):
	while l[j] != 0:
		j += 1
	l[j] = 1
	if s - (2 * j + 1) < 2 * 10 ** 5:
		l[s // 2 - (j + 1)] = 1
	sol.append(2 * j + 1)
	sol.append(s - (2 * j + 1))
	s += 8
t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(n // 2):
			print(sol[i], end=' ')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		even = []
		odd = []
		i = 2
		while True:
			even.append(i)
			if len(even) == n // 2:
				break
			i += 2
		j = 1
		while True:
			odd.append(j)
			if len(odd) == n // 2 - 1:
				break
			j += 2
		odd.append(sum(even) - sum(odd))
		even.extend(odd)
		print(' '.join(map(str, even)))


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		r = []
		for j in range(1, int(n / 2) + 1):
			l.append(2 * j)
			r.append(2 * j - 1)
		r[-1] = r[-2] + n / 2 + 2
		out = l + r
		out = map(int, out)
		print(*out)


for test in range(int(input())):
	n = int(input())
	n = n // 2
	if n % 2 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		curr = 2
		count = n
		while count > 0:
			if str(curr)[-1] != '8':
				ans.append(curr)
				count -= 1
			curr += 2
		count = n
		curr = 1
		while count > 0:
			if str(curr)[-1] != '3':
				ans.append(curr)
				count -= 1
			curr += 2
		for i in ans:
			print(i, end=' ')
		print()


N = int(input())
for k in range(N):
	a = int(input())
	mus = []
	summ = 0
	if int(a / 2) % 2 != 0:
		print('NO')
	else:
		for ka in range(1, int(a / 2) + 1):
			mus.append(ka * 2)
			summ += ka * 2
		for z in range(0, int(a / 2) - 1):
			mus.append(2 * z + 1)
			summ -= 2 * z + 1
		s = ' '
		mus.append(summ)
		print('YES')
		s = s.join(map(str, mus))
		print(s)


for i in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		l = []
		r = []
		for i in range(int((n - 2) / 2) + 1):
			l.append(2 * i + 2)
		for i in range(int((n - 2) / 2)):
			r.append(2 * i + 1)
		r.append(sum(l) - sum(r))
		print(*l, *r)
		continue
	print('NO')


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1 == 1:
		print('NO')
	else:
		print('YES')
		ans = []
		s1 = 0
		for i in range(n // 2):
			s1 += 2 * (i + 1)
			ans.append(2 * (i + 1))
		s2 = 0
		for i in range(n // 2 - 1):
			s2 += 2 * (i + 1) - 1
			ans.append(2 * (i + 1) - 1)
		ans.append(s1 - s2)
		print(*ans)


import sys
input = sys.stdin.readline
power = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
n = int(input())
for i in range(n):
	t = int(input())
	ans = [0] * (t + 1)
	if t // 2 % 2 == 1 or t == 2:
		print('NO')
	else:
		(ans, ans2) = ([], [])
		for i in range(1, t + 2):
			if i == (t + 1) // 2 + 1:
				continue
			elif i % 2 == 1:
				ans2.append(i)
			else:
				ans.append(i)
		print('YES')
		print(*ans + ans2)


from sys import stdin, stdout

def main():
	for _ in range(int(stdin.readline())):
		n = int(input())
		if n // 2 % 2 == 0:
			print('YES')
			arr = [2]
			sm = 2
			for i in range(1, n // 2):
				arr.append(arr[i - 1] + 2)
				sm += arr[i]
			tot = 0
			for i in range(n // 2, n):
				if i == n // 2:
					arr.append(1)
					tot += arr[i]
				elif i == n - 1:
					arr.append(sm - tot)
				else:
					arr.append(arr[i - 1] + 2)
					tot += arr[i]
			print(*arr)
		else:
			print('NO')
main()


for i in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(x):
			print(2 * j + 2, end=' ')
		for j in range(x - 1):
			print(2 * j + 1, end=' ')
		print(3 * x - 1)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		ans.append('NO')
	else:
		temp = []
		x = n // 2
		for i in range(x):
			temp.append(2 + 2 * i)
		for i in range(x - 1):
			temp.append(1 + 2 * i)
		temp.append(3 * x - 1)
		ans.append('YES\n' + ' '.join(map(str, temp)))
for el in ans:
	print(el)


def main():
	for _ in range(int(input())):
		n = int(input())
		if n % 4 == 0:
			print('YES')
			even = 2
			odd = 1
			for i in range(n // 2):
				print(even, end=' ')
				even += 2
			for i in range(n // 2 - 1):
				print(odd, end=' ')
				odd += 2
			total_even = n // 2
			total_odd = n // 2 - 1
			print(total_even * (total_even + 1) - total_odd * total_odd)
		else:
			print('NO')
main()


t = int(input())
l = []
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		l.append('NO')
	else:
		a = [str(i * 2) for i in range(1, n // 2 + 1)]
		for i in range(n // 2):
			a.append(str(int(a[i]) + (-1 if i < n // 2 // 2 else 1)))
		l.append('YES')
		l.append(a)
for i in l:
	print(i if type(i) == str else ' '.join(i))


def Function():
	n = int(input())
	if n % 4 == 2:
		print('NO')
		return
	else:
		a = [2 * j for j in range(1, n // 2 + 1)]
		b = [2 * j - 1 for j in range(1, n // 4 + 1)]
		c = [2 * j - 1 for j in range(n // 4 + 2, 2 * (n // 4) + 2)]
		b.extend(c)
		print('YES')
		print(' '.join((str(j) for j in a)), end=' ')
		print(' '.join((str(j) for j in b)))
for i in range(int(input())):
	Function()


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 == 1:
		print('NO')
	else:
		v = x * (x + 1)
		s = v // (x // 2)
		arr = [2 * i for i in range(1, x + 1)]
		i = 0
		t = 1
		while i < x // 2:
			if t != s - t:
				arr += [t, s - t]
				i += 1
			t += 2
		print('YES')
		print(*arr)


for _ in range(int(input())):
	N = int(input())
	i = 2
	j = 1
	L = []
	for _ in range(N // 2):
		L.append(i)
		i += 2
	for _ in range(N // 2):
		L.append(j)
		j += 2
	l = len(L)
	s1 = sum(L[:N // 2])
	s2 = sum(L[N // 2:])
	left = s1 - s2
	if (left + L[-1]) % 2 != 0:
		L[-1] = L[-1] + left
	s2 = sum(L[N // 2:])
	if s1 == s2:
		print('YES')
		print(*L)
	else:
		print('NO')


import bisect
import sys
tc = int(sys.stdin.readline())
for tx in range(tc):
	n = int(sys.stdin.readline())
	if n % 4:
		print('NO')
	else:
		print('YES')
		la = list()
		lb = list()
		for i in range(n // 2):
			la.append(i * 2 + 1)
			lb.append(i * 2 + 2)
		t = la.pop()
		t = t + n // 2
		la.append(t)
		for x in lb:
			print(x, end=' ')
		for x in la:
			print(x, end=' ')
		print()


import sys, bisect
input = sys.stdin.readline
from collections import defaultdict

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

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

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

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

def right_index(left):
	return n - left - 1
t = inp()
for _ in range(t):
	(n, k) = invr()
	nums = inlt()
	right = max(nums) + k + 1
	zero_dict = defaultdict(int)
	mid = n // 2
	m = 0
	while m < mid:
		result = nums[m] + nums[right_index(m)]
		zero_dict[result] += 1
		m += 1
	ans = [0 for i in range(right + 1)]
	pref = [0 for i in range(right + 1)]
	for i in range(mid):
		(left, rightt) = (nums[i], nums[right_index(i)])
		(lindex, rindex) = (min(left, rightt) + 1, max(left, rightt) + k)
		ans[lindex] += 1
		ans[rindex + 1] -= 1
	pref[0] = ans[0]
	for i in range(1, right + 1):
		pref[i] = pref[i - 1] + ans[i]
	min_ans = 100000000
	for i in range(1, right + 1):
		result = n - pref[i] - zero_dict[i]
		if result < min_ans:
			min_ans = result
	print(min_ans)


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *

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

def op():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		l = []
		c = 0
		s1 = 0
		for i in range(n // 2):
			c += 2
			l.append(c)
			s1 += c
		c = 1
		s2 = 0
		for i in range(n // 2 - 1):
			l.append(c)
			s2 += c
			c += 2
		l.append(abs(s2 - s1))
		print('YES')
		print(*l)


def not_valid_number(number: int) -> bool:
	return not number / 2 % 2 == 0

def build_array(half_of_test_case: int) -> list:
	first_half: list = [2]
	for i in range(half_of_test_case - 1):
		first_half.append(first_half[-1] + 2)
	second_half: list = [1]
	for i in range(half_of_test_case - 2):
		second_half.append(second_half[-1] + 2)
	sum_of_even = half_of_test_case * (half_of_test_case + 1)
	sum_of_odd = (half_of_test_case - 1) * (2 + (half_of_test_case - 2) * 2) / 2
	second_half.append(int(sum_of_even - sum_of_odd))
	return first_half + second_half

def array_to_space_separated_string(array: list) -> str:
	return ' '.join(map(str, array))

def valid_number_generator(n: int) -> str:
	number_array = build_array(int(n / 2))
	return array_to_space_separated_string(number_array)

def print_output(array: list):
	for i in array:
		print(i)
array_length: int = int(input())
output: list = []
while array_length > 0:
	test_case = int(input())
	if not_valid_number(test_case):
		output.append('NO')
	else:
		string_of_number = valid_number_generator(test_case)
		output.append('YES')
		output.append(string_of_number)
	array_length -= 1
print_output(output)


t = int(input())
for a in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for x in range(int(n / 2)):
			print(2 * x + 2, end='')
			print(' ', end='')
		for y in range(int(n / 2 - 1)):
			print(2 * y + 1, end='')
			print(' ', end='')
		print(int(1.5 * n - 1))
	else:
		print('NO')


import sys
import math
from collections import deque
import random

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 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
t = read_int()
for i in range(t):
	n = read_int()
	if n % 4 == 2:
		print('NO')
	else:
		f = []
		s = []
		for i in range(1, n // 2 + 1):
			f.append(2 * i)
		for i in range(1, n // 2):
			s.append(2 * i - 1)
		k = n // 4
		s.append(6 * k - 1)
		ans = f + s
		print('YES')
		print(*ans)


t = int(input())
while t > 0:
	n = int(input())
	g = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			g.append(i)
		for i in range(1, n, 2):
			g.append(i)
		g[len(g) - 1] += n // 2
		print(' '.join(map(str, g)))
	t -= 1


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


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('Yes')
	t = n // 4
	a = []
	for j in range(2 * t):
		a.append(2 * j + 2)
	for j in range(2 * t + 1):
		if j == t:
			continue
		a.append(2 * j + 1)
	for el in a:
		print(el, end=' ')
	print('')


T = int(input())
for t in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = []
		for i in range(1, n // 2 + 1):
			a.append(2 * i)
		for i in range(n // 2 - 1):
			a.append(2 * i + 1)
		a.append(a[-1] + n // 2 + 2)
		print('YES')
		print(*a)


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	ar = list(map(int, input().split()))
	r1 = {}
	r2 = {}
	h = [0] * (m + m + 1)
	for i in range(n // 2):
		x = ar[i]
		y = ar[-(i + 1)]
		h[x + y] -= 1
		a = 1 + min(x, y)
		b = m + max(x, y)
		if r1.get(a) == None:
			r1[a] = 1
		else:
			r1[a] += 1
		if r2.get(b) == None:
			r2[b] = 1
		else:
			r2[b] += 1
	ans = n
	rslt = n
	for i in range(2, m + m + 1):
		if r1.get(i) != None:
			ans -= r1[i]
		rslt = min(ans + h[i], rslt)
		if r2.get(i) != None:
			ans += r2[i]
	print(rslt)


for k in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		par = 2
		impar = 1
		string = ''
		for i in range(n):
			if i < n / 2:
				string += str(par) + ' '
				par += 2
			elif i != n - 1:
				string += str(impar) + ' '
				impar += 2
			else:
				string += str(n // 2 * 3 - 1)
		print(string)


ans = []
yes_list = []
test_case = int(input())

def main():
	length = int(input())
	if length % 4 == 0:
		ans.append('YES')
		yes_list_even = [2 * i for i in range(1, length // 2 + 1)]
		yes_list_instant = yes_list_even + [yes_list_even[i] - 1 for i in range(len(yes_list_even) // 2)] + [yes_list_even[i] + 1 for i in range(len(yes_list_even) // 2, len(yes_list_even))]
		yes_list.append(yes_list_instant)
	else:
		ans.append('NO')
for i in range(test_case):
	main()
k = 0
for an in ans:
	if an == 'YES':
		print(an)
		print(*yes_list[k])
		k += 1
	else:
		print(an)


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		sum_even = 0
		sum_odd = 0
		for i in range(2, 2 * x + 1, +2):
			arr.append(i)
			sum_even += i
		for i in range(1, 2 * x - 1, +2):
			arr.append(i)
			sum_odd += i
		arr.append(sum_even - sum_odd)
		print(*arr)


def RA():
	l = input().split()
	return [int(s) for s in l]

def solve():
	(n, k) = RA()
	arr = RA()
	scores = [[0, 0, 0] for i in range(2 * k + 1)]
	for i in range(n // 2):
		a = arr[i]
		b = arr[n - i - 1]
		mini = min(a, b) + 1
		maxi = a + b + k - min(a, b)
		scores[mini][0] += 1
		scores[a + b][1] += 1
		scores[maxi][2] += 1
	needChange = n
	best = needChange
	for i in range(2, 2 * k + 1):
		needChange -= scores[i][0]
		best = min(best, needChange - scores[i][1])
		needChange += scores[i][2]
	print(best)
t = int(input())
for i in range(t):
	solve()


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		a = []
		n = n // 2
		print('YES')
		for j in range(1, n + 1):
			a.append(2 * j)
		for j in range(1, n):
			a.append(2 * j - 1)
		a.append(3 * n - 1)
		print(*a)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	a = [0 for i in range(n)]
	if k % 2 == 1:
		print('NO')
	else:
		for i in range(k // 2):
			a[i] = 2 * (i + 1)
			a[i + k // 2] = 2 * (i + k // 2 + 1)
			a[i + k] = 2 * (i + 1) - 1
			a[i + k + k // 2] = 2 * (i + k // 2 + 1) + 1
		print('YES')
		a = [str(i) for i in a]
		print(' '.join(a))


a = input()
for i in range(int(a)):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		continue
	n = int(n / 2)
	print('YES')
	print(*range(2, 2 * (n + 1), 2), end=' ')
	print(*range(1, 1 + 2 * (n - 1), 2), end=' ')
	print(sum(range(2, 2 * (n + 1), 2)) - sum(range(1, 1 + 2 * (n - 1), 2)))


q = int(input())
for _ in range(q):
	n = int(input())
	if n % 4:
		print('NO')
		continue
	print('YES')
	for i in range(n // 2):
		print(2 * (i + 1), end=' ')
	for i in range(n // 2 - 1):
		print(2 * i + 1, end=' ')
	print(n - 1 + n // 2)


def funct(c):
	k = c // 2
	if c % 4 != 0:
		print('NO')
	else:
		even = [i * 2 for i in range(1, k + 1)]
		odd = [2 * j - 1 for j in range(1, k + 1)]
		odd[-1] += k
		print('YES')
		print(*even + odd)
test_cases = int(input())
for i in range(test_cases):
	c = int(input())
	funct(c)


is_even = list()
is_odd = list()
for i in range(1, 305001, 1):
	if i % 2 == 0:
		is_even.append(i)
	else:
		is_odd.append(i)
k = int(input())
for i in range(k):
	s = int(input())
	su = s // 2
	if su % 2 == 0:
		print('YES')
		su_even = is_even[0:su]
		su_odd = is_odd[0:su - 1]
		pu = su // 2
		sup = su - 1 + pu
		su2 = is_odd[sup]
		su_odd.append(su2)
		ulti = su_even + su_odd
		print(*ulti)
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = []
		b = []
		for i in range(2, n + 1, 2):
			a.append(i)
		for i in range(1, n + 1, 2):
			b.append(i)
		if sum(a) != sum(b):
			c = sum(a) - sum(b)
			b[-1] = b[-1] + c
		print('YES')
		print(*a, *b)


import math, sys

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

def ls():
	return list(map(int, list(input())))

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

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = ii()
for _ in range(t):
	n = ii()
	if n // 2 % 2 == 0:
		even = []
		odd = []
		for x in range(1, n // 2 + 1):
			even.append(2 * x)
			odd.append(2 * x - 1)
		odd[-1] = sum(even) - sum(odd[0:n // 2 - 1])
		even.extend(odd)
		print('YES')
		print(*even)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	h = n // 2
	max_s_array = [0] * (2 * k + 1)
	min_s_array = [0] * (2 * k + 1)
	for i in range(h):
		min_s = 1 + min(a[i], a[n - 1 - i])
		max_s = k + max(a[i], a[n - 1 - i])
		min_s_array[min_s] += 1
		max_s_array[max_s] += 1
		min_s_array[a[i] + a[n - 1 - i]] += 1
		max_s_array[a[i] + a[n - 1 - i]] += 1
	out = 0
	accumulated = 0
	for i in range(2 * k + 1):
		accumulated += min_s_array[i]
		out = max(out, accumulated)
		accumulated -= max_s_array[i]
	print(n - out)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	k = 2
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		x = int(n / 2)
		for i in range(1, x + 1):
			print(2 * i, end=' ')
		for i in range(1, x):
			print(2 * i - 1, end=' ')
		print(3 * x - 1)


t = int(input())
for i in range(t):
	n = int(input())
	q = n // 2
	r = n % 2
	if q % 2 != 0 or r % 2 != 0:
		print('NO')
		continue
	(even, odd) = ([], [])
	for j in range(1, n // 2 + 1):
		even.append(2 * j)
		odd.append(2 * j - 1)
	if sum(odd) != sum(even):
		odd[-1] += n // 2
	print('YES', '')
	print(*even, end='')
	print('', *odd)


def D():
	T = int(input())
	while T != 0:
		T = T - 1
		(n, k) = map(int, input().split())
		Arr = [int(i) for i in input().split(' ')]
		FreqArr = [0] * (2 * k + 1)
		d = len(Arr) // 2
		maxctn = 0
		for i in range(0, d):
			index = Arr[i] + Arr[n - 1 - i]
			FreqArr[index] += 1
			if FreqArr[index] > maxctn:
				maxctn = FreqArr[index]
		if maxctn == n // 2:
			print(0)
			continue
		Pref = [0] * (2 * k + 2)
		for j in range(0, d):
			MinSum = min(Arr[j], Arr[n - 1 - j]) + 1
			MaxSum = max(Arr[j], Arr[n - 1 - j]) + k
			Pref[MinSum] += 1
			Pref[MaxSum + 1] -= 1
		ans = 100000000000.0
		for i in range(2, 2 * k + 1):
			Pref[i] = Pref[i - 1] + Pref[i]
			val1 = Pref[i] - FreqArr[i]
			val2 = 2 * (d - Pref[i])
			ans = min(ans, val1 + val2)
		print(ans)
D()


t = int(input())
for i in range(t):
	case = int(input())
	half = case // 2
	if half % 2 == 1:
		print('NO')
	else:
		print('YES')
		evens = 2
		odds = 1
		ans = []
		for x in range(half):
			ans.append(evens)
			evens += 2
		for x in range(half - 1):
			ans.append(odds)
			odds += 2
		ans.append(odds + half)
		print(*ans)


for _ in range(int(input())):
	o = ''
	e = ''
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		c = 1
		t = 0
		print('YES')
		for i in range(n):
			t += 1
			if t == 3:
				t = 1
				c += 1
			if c % 2 == 0:
				e += str(c) + ' '
			else:
				o += str(c) + ' '
			c += 1
		print(e + o)


for i in range(int(input())):
	num = int(input())
	if num // 2 % 2 == 1:
		print('NO\n')
	else:
		ar = []
		sumn = 0
		sumn1 = 0
		for j in range(2, num + 1, 2):
			ar.append(j)
			sumn += j
		for k in range(1, num - 1, 2):
			ar.append(k)
			sumn1 += k
		ar.append(sumn - sumn1)
		print('YES\n')
		for _ in ar:
			print(_, end=' ')
			print('\n')


import math
for _ in range(int(input())):
	n = int(input())
	if (n - 2) % 4 == 0:
		print('NO')
	else:
		sum = n / 4 * (2 * 2 + (n / 2 - 1) * 2)
		ans = []
		odd = []
		for i in range(1, n // 2):
			val = 2 * i - 1
			odd.append(int(val))
			sum -= val
		odd.append(int(sum))
		for i in range(1, n // 2 + 1):
			ans.append(2 * i)
		ans = ans + odd
		print('YES')
		print(*ans)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def yo():
	for _ in range(int(input().strip())):
		(n, k) = map(int, input().split())
		nums = list(map(int, input().split()))
		common_values = [0 for _ in range(2 * k + 2)]
		for i in range(n // 2):
			(a, b) = (nums[i], nums[n - 1 - i])
			common_values[a + b - max(a, b) + 1] -= 1
			common_values[a + b] -= 1
			common_values[a + b + 1] += 1
			common_values[a + b - min(a, b) + k + 1] += 1
		common_values[1] = n
		minimum = n
		for i in range(2, 2 * k + 1):
			common_values[i] += common_values[i - 1]
			minimum = min(minimum, common_values[i])
		print(minimum)
yo()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4 == 0:
			print('YES')
			init = 2
			a = [0] * n
			for i in range(0, n // 2, 2):
				a[i] = init
				a[i + 1] = init + 2
				rev_index = n - i - 1
				a[rev_index] = init - 1
				a[rev_index - 1] = init + 3
				init += 6
			print(*a)
		else:
			print('NO')
main()


t = int(input())
valores = []
for i in range(t):
	valores.append(int(input()))
for i in valores:
	if i / 2 % 2 == 1:
		print('NO')
	else:
		a = []
		for j in range(i // 2):
			a.append(2 * (j + 1))
		for j in range(i // 2 - 1):
			a.append(2 * j + 1)
		a.append(3 * (i // 2) - 1)
		print('YES')
		print(*a)


t = int(input())
for i in range(t):
	a = int(input())
	b = a // 2
	if b % 2 != 0:
		print('NO')
	else:
		print('YES')
		w = []
		z = []
		for j in range(1, a + 1):
			if j % 2 == 0:
				w.append(j)
			else:
				z.append(j)
		x = w + z[:-1]
		for i in x:
			print(i, end=' ')
		print(z[-1] + b)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ' '.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	k = n // 2
	if k % 2:
		print('NO')
		continue
	print('YES')
	a = [0 for i in range(n)]
	for i in range(k):
		a[i] = 2 * i + 2
	j = 1
	for i in range(k, n):
		a[i] = j
		j += 2
	a[n - 1] += k
	print(nospace(a))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


import sys
input = sys.stdin.readline
from itertools import accumulate
t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	ANS = [0] * (k * 2 + 3)
	for i in range(n // 2):
		(x, y) = (A[i], A[n - 1 - i])
		if x > y:
			(x, y) = (y, x)
		ANS[x + 1] -= 1
		ANS[y + k + 1] += 1
		ANS[x + y] -= 1
		ANS[x + y + 1] += 1
	S = list(accumulate(ANS))
	print(n + min(S))


T = int(input())
for _ in range(0, T):
	(n, k) = map(int, input().split())
	s = [int(x) for x in input().split()]
	dp = [0] * (2 * k + 5)
	tt = [0] * (2 * k + 5)
	for i in range(n // 2):
		a = min(s[i], s[n - i - 1])
		b = max(s[i], s[n - i - 1])
		low = a + 1
		high = min(b + k, 2 * k)
		dp[low] += 1
		dp[high + 1] -= 1
		dp[2] += 2
		dp[low] -= 2
		dp[high + 1] += 2
		dp[2 * k + 1] -= 2
		tt[a + b] -= 1
	ans = 2 * n
	for i in range(3, len(dp)):
		dp[i] += dp[i - 1]
	for i in range(2, 2 * k + 1):
		ans = min(ans, dp[i] + tt[i])
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	lst = []
	if n % 4 == 0:
		for i in range(1, n // 2 + 1):
			lst.append(2 * i)
		j = 0
		for i in range(n // 4):
			lst.append(lst[j] - 1)
			j += 1
		for i in range(n // 4):
			lst.append(lst[j] + 1)
			j += 1
		print('YES')
		print(*lst, sep=' ')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = []
		b = []
		for j in range(1, 1 + n // 2):
			a.append(2 * j)
			b.append(2 * j - 1)
		b[n // 2 - 1] = a[n // 2 - 1] + n // 2 - 1
		c = map(str, a + b)
		print('YES')
		print(' '.join(c))


def solve(n):
	a = []
	if n % 4 == 0:
		n_ = int(n / 4)
		for i in range(n_):
			a.append(str(2 + i * 2))
			a.append(str(n - i * 2))
		for i in range(n_):
			a.append(str(1 + i * 2))
			a.append(str(n + 1 - i * 2))
		print('YES')
		print(' '.join(a))
	else:
		print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	solve(n)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		right_arr = [2 * x for x in range(1, int(n / 2) + 1)]
		left_arr = [None for j in range(int(n / 2))]
		for j in range(int(n / 4)):
			left_arr[j] = right_arr[j] - 1
		for j in range(int(n / 4), int(n / 2)):
			left_arr[j] = right_arr[j] + 1
		for j in range(int(n / 2)):
			print(right_arr[j], end=' ')
		for j in range(int(n / 2)):
			print(left_arr[j], end=' ')
		print('')


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	p = []
	for i in range(1, n // 2 + 1):
		l.append(2 * i)
	for i in range(n // 2 - 1):
		p.append(2 * i + 1)
	d = sum(l) - sum(p)
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(*l, *p, d)


def makeList(num):
	mes = []
	for i in range(num // 2):
		mes.append((i + 1) * 2)
	for i in range(num // 2 - 1):
		mes.append(mes[i] - 1)
	mes.append(mes[num // 2 - 1] + num // 2 - 1)
	for i in mes:
		print(i, end=' ')
	print()
n = int(input())
arr = [int(input()) for i in range(n)]
for i in arr:
	if i == 2 or i / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		makeList(i)


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 12

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, b):
	for i in range(26):
		for j in range(len(a) + 1):
			q = a[:j] + chr(97 + i) + a[j:]
			if q == b:
				return 1
	return 0

def solve(a, n, k):
	p = dc(int)
	l = []
	r = []
	for i in range(n // 2):
		p[a[i] + a[n - 1 - i]] += 1
	q = [0] * (2 * k + 2)
	for i in range(n // 2):
		(l, r) = (min(a[i], a[n - 1 - i]), max(a[i], a[n - 1 - i]))
		q[l + 1] += 1
		q[r + k + 1] += -1
	for i in range(1, len(q)):
		q[i] = q[i] + q[i - 1]
	ans = float('inf')
	for i in range(2, 2 * k + 1):
		ans = min(ans, q[i] - p[i] + 2 * (n // 2 - q[i]))
	return ans
for _ in range(inp()):
	(n, k) = line()
	a = line()
	l = solve(a, n, k)
	print(l)


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		l = [0] * n
		a = 2
		print('YES')
		for i in range(n // 2):
			l[i] = a
			l[n // 2 + i] = a - 1
			a += 2
		sum1 = sum(l[0:n // 2])
		l[n - 1] = sum1 - sum(l[n // 2:n - 1])
		for i in range(len(l)):
			l[i] = str(l[i])
		print(' '.join(l))
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if int(n / 2) % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = []
		b = [2 * j for j in range(1, int(n / 2) + 1)]
		c1 = [2 * j - 1 for j in range(1, int(n / 4) + 1)]
		c2 = [2 * j + 1 for j in range(int(n / 4) + 1, int(n / 2) + 1)]
		a = b + c1 + c2
		print(*a)


for _ in range(int(input())):
	n = int(input())
	a = [0] * n
	for i in range(n // 2):
		a[i] = 2 * i + 2
		a[n // 2 + i] = 2 * i + 1
	(ev, od) = (sum(a[:n // 2]), sum(a[n // 2:]))
	if abs(ev - od) % 2 != 0:
		print('NO')
	else:
		print('YES')
		if ev > od:
			a[-1] += ev - od
		else:
			a[n // 2 - 1] += od - ev
		for i in range(n):
			print(a[i], end=' ')
		print()


t = int(input())
list1 = []
list2 = []
list3 = []
list4 = []
list5 = []
sum3 = 0
sum4 = 0
for test_case in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		list1.append('NO')
	elif n == 2:
		list1.append('NO')
	else:
		list1.append('YES')
		for number1 in range(2, n + 1, 2):
			list2.append(number1)
		list3 = list2[int(-n / 2):]
		for number3 in list3:
			sum3 += number3
		list1.extend(list3)
		for number2 in range(1, n - 2, 2):
			list4.append(number2)
		for number4 in list4:
			sum4 += number4
		list4.append(sum3 - sum4)
		list1.extend(list4)
	for items in list1:
		if type(items) is str:
			print(items)
		else:
			list5.append(items)
	if len(list5) > 0:
		print(' '.join((str(items) for items in list5)))
	list1.clear()
	list2.clear()
	list3.clear()
	list4.clear()
	list5.clear()
	sum3 = 0
	sum4 = 0


for _ in range(int(input())):
	n = int(input())
	m = n / 2
	if m % 2 == 1:
		print('NO')
	else:
		print('YES')
		(s, sum) = (0, 0)
		(v1, v2) = ([], [])
		for i in range(int(m)):
			v1.append(2 * i + 2)
			s += v1[i]
		for i in range(int(m - 1)):
			v2.append(2 * i + 1)
			sum += v2[i]
		v2.append(s - sum)
		v = v1
		for i in range(len(v2)):
			v.append(v2[i])
		print(' '.join(map(str, v)))


for _ in range(int(input())):
	a = list()
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			a.append(i * 2)
		for i in range(1, n // 2 + 1):
			a.append(i * 2 - 1)
		a[-1] += n // 2
		print(*a)


MAX_VAL = 400005

def countIntervals(arr, N):
	minimum = 2 * 10 ** 5 + 2
	maximum = 0
	freq = [0] * (2 * k + 2)
	for i in range(0, N):
		li = arr[i][0]
		freq[li] = freq[li] + 1
		ri = arr[i][1]
		freq[ri + 1] = freq[ri + 1] - 1
		if li < minimum:
			minimum = li
		if ri > maximum:
			maximum = ri
	for i in range(minimum, maximum + 1):
		freq[i] = freq[i] + freq[i - 1]
	return freq
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = []
	b = 0
	c = 0
	d = []
	r = dict()
	for j in range(n // 2):
		su = l[j] + l[n - 1 - j]
		a.append(su)
		b = 1 + min(l[j], l[n - 1 - j])
		c = k + max(l[j], l[n - 1 - j])
		if su in r:
			r[su] += 1
		else:
			r.update({su: 1})
		d.append([b, c])
	a = list(set(a))
	u = len(d)
	tw = countIntervals(d, u)
	ans = 999999999999999999999999999
	for j in range(len(a)):
		t = tw[a[j]]
		m = (n // 2 - t) * 2 + t - r[a[j]]
		ans = min(ans, m)
	print(min(n // 2, ans))


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		ev = []
		od = []
		for i in range(1, 10000000, 5):
			if len(ev) + len(od) >= n:
				break
			if i % 2 == 1:
				ev.append(i + 1)
				ev.append(i + 3)
				od.append(i)
				od.append(i + 4)
			else:
				od.append(i + 1)
				od.append(i + 3)
				ev.append(i)
				ev.append(i + 4)
		l = ev + od
		print(*l)


a = int(input())
for i in range(a):
	b = int(input())
	if b // 2 % 2 != 0:
		print('NO')
	else:
		s = []
		q = []
		m = []
		f = 2
		for j in range(1, b // 2 + 1):
			s.append(f)
			if j % 2 == 0:
				g = f + 1
			else:
				g = f - 1
			q.append(g)
			f = f + 4
		m = s + q
		print('YES')
		print(' '.join([str(i) for i in m]))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		arr = [0 for i in range(n)]
		e = 2
		s = 0
		o = 1
		s1 = 0
		for i in range(n // 2):
			arr[i] = e
			if i != n // 2 - 1:
				arr[n - 1 - i] = o
				s1 += o
				o += 2
			s += arr[i]
			e += 2
		arr[n // 2] = int(s - s1)
		print('YES')
		print(*arr)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		i = 2
		l = []
		s = 0
		for _ in range(n // 2):
			s += i
			l.append(i)
			i += 2
		i = 1
		for _ in range(n // 2 - 1):
			s -= i
			l.append(i)
			i += 2
		l.append(s)
		print(' '.join(map(str, l)))


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	values = list(map(int, input().split()))
	zero = [0] * (2 * k + 2)
	one = [0] * (2 * k + 2)
	prefix_one = [0] * (2 * k + 2)
	two = [0] * (2 * k + 2)
	for i in range(n // 2):
		temp = values[i] + values[n - i - 1]
		min_sum = min(values[i], values[n - i - 1]) + 1
		max_sum = max(values[i], values[n - i - 1]) + k + 1
		one[min_sum] += 1
		one[max_sum] -= 1
		zero[temp] += 1
	for i in range(2, 2 * k + 1):
		prefix_one[i] = prefix_one[i - 1] + one[i]
	for i in range(2, 2 * k + 1):
		two[i] = n // 2 - prefix_one[i]
	ans = prefix_one[2] + 2 * two[2] - zero[2]
	for i in range(3, 2 * k + 1):
		ans = min(ans, 1 * prefix_one[i] + 2 * two[i] - zero[i])
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	e = [2 + i for i in range(0, n, 2)]
	o = []
	s = sum(e)
	for j in range(1, n - 1, 2):
		o.append(j)
		s = s - j
	if s < 0 or s % 2 == 0:
		print('NO')
	else:
		print('YES')
		e.extend(o)
		e.append(s)
		for g in e:
			print(g, end=' ')
		print()


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		i = 0
		x = 2
		sum = 0
		while i < n / 2:
			ans.append(2 + i * 2)
			sum += 2 + i * 2
			i += 1
		y = 1
		i = 0
		odd = 0
		while i < n / 2 - 1:
			ans.append(1 + i * 2)
			odd += 1 + i * 2
			i += 1
		ans.append(sum - odd)
		for i in ans:
			print(i, end=' ')
		print()
	t -= 1


import sys
t_cases = int(input())
for _ in range(t_cases):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cnt = [0] * (2 * k + 1)
	for i in range(n // 2):
		cnt[a[i] + a[n - i - 1]] += 1
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		l1 = 1 + a[i]
		r1 = k + a[i]
		l2 = 1 + a[n - i - 1]
		r2 = k + a[n - i - 1]
		pref[min(l1, l2)] += 1
		pref[max(r1, r2) + 1] -= 1
	for i in range(1, len(pref) - 1):
		pref[i] += pref[i - 1]
	res = sys.maxsize
	for i in range(2, 2 * k + 1):
		res = min(res, pref[i] - cnt[i] + (n // 2 - pref[i]) * 2)
	print(res)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('No')
	else:
		x = []
		t = 2
		for i in range(n // 2):
			x.append(t)
			t += 2
		t = 0
		for j in range(1, n // 2 + 1):
			if j == n // 2:
				x.append(x[t] + n // 2 - 1)
			else:
				x.append(x[t] - 1)
				t += 1
		print('YES')
		for i in x:
			print(i, end=' ')
		print()


from sys import stdin
from sys import stdout
sprint = stdout.write
sinput = stdin.readline

def func():
	n = int(sinput())
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	for i in range(2, n + 1, 2):
		print(i, end=' ')
	for i in range(1, n - 1, 2):
		print(i, end=' ')
	print((3 * n - 2) // 2)
t = int(sinput())
while t != 0:
	if t == 1000 - 84 + 1 + t:
		int(sinput())
		sprint()
		t -= 1
	else:
		t -= 1
		func()


t = int(input())
for tt in range(0, t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		s1 = ''
		s2 = ''
		for i in range(1, int(n / 2) + 1):
			s1 += ' ' + str(int(2 * i))
			a = int(2 * i - 1)
			if i != int(n / 2):
				s2 += ' ' + str(a)
			else:
				s2 = s2 + ' ' + str(a + int(n / 2))
		s = s1 + s2
		s = s.strip()
		print('YES')
		print(s)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	else:
		l1 = []
		l2 = []
		for i in range(1, n // 2):
			l1.append(2 * i)
			l2.append(2 * i - 1)
		l1.append(n)
		l2.append(n + (n // 2 - 1))
		l = l1 + l2
		print('YES')
		print(*l)


import sys
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

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

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

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	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
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	t = inin()
	while t > 0:
		n = inin()
		arr = []
		if n % 4 != 0:
			print('NO')
		else:
			print('YES')
			for i in range(1, n // 2 + 1):
				arr.append(2 * i)
			sum1 = sum(arr)
			for j in range(1, n // 2):
				arr.append(2 * j - 1)
			sum2 = sum(arr)
			sum2 = 2 * sum1 - sum2
			arr.append(sum2)
			print(*arr)
		t = t - 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		l = n // 2
		even = list(range(2, 2 * l + 1, 2))
		odd = list(range(1, 2 * l + 1, 2))
		odd[-1] += l
		print('YES')
		print(' '.join(map(str, even + odd)))
	else:
		print('NO')


times = int(input())
ans = []
for i in range(times):
	num = int(input())
	if num / 2 % 2 == 1:
		ans.append('NO')
	else:
		ans.append('YES')
		arr = []
		for k in range(int(num / 2)):
			arr.append(2 * (k + 1))
			if k == num / 2 - 1:
				arr.append(int(2 * (k + 1) + (num / 2 - 1)))
		for k in range(int(num / 2) - 1):
			arr.append(1 + 2 * k)
		ans.append(arr)
for i in ans:
	if type(i) == list:
		print(' '.join((str(k) for k in i)))
	else:
		print(i)


import sys
input = sys.stdin.readline
for q in range(int(input())):
	n = int(input())
	start = 2
	even = 0
	tmp = n // 2
	res = []
	for i in range(tmp):
		res.append(start)
		even += start
		start += 2
	odd = even - tmp
	if (even - odd) % 2 == 1:
		print('NO')
	else:
		start = 1
		for i in range(tmp - 1):
			res.append(start)
			start += 2
		start += even - odd
		res.append(start)
		print('YES')
		print(*res)


for t in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(1, n // 2):
			print(2 * i - 1, end=' ')
		print(int(n * 1.5 - 1))


for i in range(int(input())):
	n = int(input())
	e = 0
	co = 0
	o = 0
	on = 1
	l = list()
	for i in range(2, n + 1, 2):
		e += i
		l.append(i)
	while co != n / 2 - 1:
		o += on
		l.append(on)
		co += 1
		on += 2
	if (e - o) % 2 == 0:
		print('NO')
	else:
		l.append(e - o)
		print('YES')
		print(*l)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import log2

class SegmentTree:

	def __init__(self, array):
		self.n = len(array)
		self.size = 2 ** (int(log2(self.n - 1)) + 1)
		self.default = 0
		self.data = [self.default] * (2 * self.size)
		self.process(array)

	def process(self, array):
		self.data[self.size:self.size + self.n] = array

	def query(self, index):
		res = self.default
		index += self.size
		while index:
			res += self.data[index]
			index >>= 1
		return res

	def update(self, alpha, omega, value):
		alpha += self.size
		omega += self.size + 1
		while alpha < omega:
			if alpha & 1:
				self.data[alpha] += value
				alpha += 1
			if omega & 1:
				omega -= 1
				self.data[omega] += value
			alpha >>= 1
			omega >>= 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	arr = [0] * (2 * k + 1)
	st = SegmentTree(arr)
	di = {}
	while i < j:
		(mi, ma) = (min(a[i], a[j]), max(a[i], a[j]))
		s = str(mi) + ',' + str(ma)
		di[s] = 1 if s not in di else di[s] + 1
		i += 1
		j -= 1
	for each in di:
		(mi, ma) = [int(k) for k in each.split(',')]
		total = mi + ma
		st.update(0, mi, 2 * di[each])
		st.update(mi + 1, total - 1, 1 * di[each])
		if total != 2 * k:
			st.update(total + 1, ma + k, 1 * di[each])
		if ma != k:
			st.update(ma + k + 1, 2 * k, 2 * di[each])
	print(min([st.query(k) for k in range(2 * k + 1)]))


t = int(input())
s = []
for i in range(0, t):
	n = int(input())
	if n % 4 != 0:
		s.append(['NO'])
	else:
		s.append(['YES'])
		p = []
		f = 0
		q = 0
		for i in range(0, int(n // 2)):
			f += 2
			p.append(f)
			q += f
		f = 1
		r = 0
		for i in range(0, int(n // 2) - 1):
			r += f
			p.append(f)
			f += 2
		p.append(q - r)
		s.append(p)
for i in s:
	for j in i:
		print(j, end=' ')
	print()


cases = int(input())
for i in range(cases):
	fin_array = []
	arraylen = int(input())
	if arraylen / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, arraylen + 1, 2):
			fin_array.append(i)
		for i in range(1, arraylen - 2, 2):
			fin_array.append(i)
		fin_array.append(0)
		fin_array[-1] = sum(fin_array[:int(arraylen / 2)]) - sum(fin_array[int(arraylen / -2):])
		listToStr = ' '.join([str(elem) for elem in fin_array])
		print(listToStr)


tests = int(input())
for test in range(tests):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		even = [2 * x for x in range(1, n // 2 + 1)]
		odd = [2 * x + 1 for x in range(n // 2 - 1)]
		odd.append(n // 2 * (n // 2 + 1) - ((n - 1) // 2) ** 2)
		odd_even = ' '.join(map(str, even + odd))
		print(odd_even)
	else:
		print('NO')


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
n = ii()
for _ in range(n):
	t = ii()
	if t // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		s = 2
		lol = []
		for i in range(t // 2):
			print(s, end=' ')
			lol.append(s)
			s += 4
		for i in range(t // 2):
			if i % 2 == 0:
				print(lol[i] - 1, end=' ')
			else:
				print(lol[i] + 1, end=' ')
		print()


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 math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def abs(x):
	return x if x >= 0 else -x

def sumelem(x, start, end):
	sum = 0
	for i in range(start, end + 1):
		sum += x[i]
	return sum
for t in range(int(input())):
	n = int(input())
	if (n // 2 + n - 1) % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(1, n // 2):
			print(2 * i - 1, end=' ')
		print(n // 2 + n - 1)


import sys
input = sys.stdin.readline
ans = []
t = int(input())
from itertools import accumulate
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	ans = [0] * (2 * k + 2)
	for i in range(n // 2):
		sum_ = a[i] + a[-i - 1]
		max_ = max(a[i], a[-i - 1]) + k
		min_ = min(a[i], a[-i - 1]) + 1
		ans[0] += 2
		ans[min_] -= 1
		ans[max_ + 1] += 1
		ans[sum_] -= 1
		ans[sum_ + 1] += 1
	if n == 2:
		print(0)
		continue
	acm = list(accumulate(ans))
	print(min(acm))


import math
n = int(input())
for i in range(n):
	m = int(input())
	if m % 2 == 0 and m / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		res = [0] * m
		for i in range(m // 2):
			res[i] = 2 * i + 2
			res[m // 2 + i] = 2 * i + 1
		sumt = m * (m + 1) // 2
		sump = m // 2 * (m // 2 + 1)
		sumi = sumt - sump
		remaim = sump - sumi
		res[m - 1] += remaim
		print(*res, sep=' ')


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		l = [0] * n
		even = n // 4 * (4 + (n // 2 - 1) * 2)
		for i in range(n // 2):
			l[i] = 2 * (i + 1)
		odd = 0
		for i in range(n // 2, n - 1):
			l[i] = (i - n // 2) * 2 + 1
			odd += l[i]
		l[n - 1] = even - odd
		if max(l) > 10 ** 9:
			print('NO')
		else:
			print('YES')
			for i in l:
				print(i, end=' ')
			print()


t = int(input())
n = [0 for x in range(0, t)]
for i in range(t):
	n[i] = int(input())
for i in n:
	if i % 4 != 0:
		print('No')
	else:
		print('YES')
		print(*range(2, i + 1, 2), *range(1, i - 1, 2), i * 3 // 2 - 1)


def solve(n):
	if n // 2 % 2 == 1:
		print('NO')
		return
	else:
		res = []
		for i in range(0, n // 2):
			res.append((i + 1) * 2)
		for i in range(0, n // 2):
			res.append((i + 1) * 2 - 1)
		res[n - 1] = res[n - 1] + n // 2
		print('YES')
		print(' '.join(map(str, res)))
t = int(input())
for i in range(0, t):
	n = int(input())
	solve(n)


for i in range(int(input())):
	n = int(input())
	k = int(n / 2)
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		s1 = 0
		for i in range(k):
			print(2 * (i + 1), end=' ')
			s1 += 2 * (i + 1)
		s2 = 0
		for i in range(k - 1):
			print(2 * i + 1, end=' ')
			s2 += 2 * i + 1
		print(s1 - s2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	s1 = 0
	for i in range(n // 2):
		a.append(2 * (i + 1))
		s1 += 2 * (1 + i)
	s2 = 0
	for i in range(n // 2 - 1):
		a.append(2 * i + 1)
		s2 += 2 * i + 1
	s3 = s1 - s2
	a.append(s3)
	if s3 % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in a:
			print(i, end=' ')
		print()


t = int(input())
while t > 0:
	n = int(input())
	res1 = []
	res2 = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			res1.append(i)
		j = 1
		for i in range(n // 2 - 1):
			res2.append(j)
			j += 2
		res2.append(sum(res1) - sum(res2))
		res3 = res1 + res2
		res3 = list(map(str, res3))
		print(' '.join(res3))
	t -= 1


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(n):
	k = n // 2
	if k % 2 == 0:
		print('YES')
		res = [2 * i for i in range(1, k + 1)] + [2 * i - 1 for i in range(1, k + 1)]
		res[-1] += k
		print(' '.join([str(e) for e in res]))
	else:
		print('NO')
t = iint()
for _ in range(t):
	n = iint()
	solve(n)


import math
t = int(input())
for i in range(t):
	n = int(input())
	even = []
	odd = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		num = 0
		for i in range(0, n // 2):
			num = num + 2
			even.append(num)
			odd.append(num - 1)
		odd.pop()
		num1 = sum(even) - sum(odd)
		odd.append(num1)
		even = even + odd
		for i in even:
			print(i, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	i = n // 2
	l = []
	if i % 2 != 0:
		print('NO')
	else:
		for j in range(1, i + 1):
			l.append(j * 2)
		s = sum(l)
		m = 1
		t = 0
		for k in range(1, i):
			l.append(m)
			t = t + m
			m += 2
		l.append(s - t)
		print('YES')
		print(*l)


T = int(input())
for _ in range(0, T):
	n = int(input())
	tt = n // 2
	if tt % 2 != 0:
		print('NO')
	else:
		print('YES')
		c = 2
		for i in range(n // 2):
			print(c, end=' ')
			c += 2
		c = 1
		for i in range(n // 2 - 1):
			print(c, end=' ')
			c += 2
		c += n // 2
		print(c)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		even_list = list(range(2, n + 1, 2))
		odd_list = list(range(1, n - 1, 2))
		odd_list.append(sum(even_list) - sum(odd_list))
		print(' '.join((str(x) for x in even_list + odd_list)))


t = int(input())
while t:
	t -= 1
	n = int(input())
	p = n // 2
	if p % 2:
		print('NO')
	else:
		ls = [i for i in range(2, n + 1, 2)]
		sum1 = sum(ls)
		qs = [i for i in range(1, n - 1, 2)]
		qs.append(sum1 - sum(qs))
		print('YES')
		print(*ls + qs)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	L = list(map(int, input().split()))
	prefix = [0] * (2 * K + 2)
	ma = [0] * (2 * K + 2)
	for i in range(N // 2):
		x = L[i]
		y = L[N - 1 - i]
		ma[x + y] += 1
		prefix[min(x, y) + 1] += 1
		prefix[max(x, y) + K + 1] -= 1
	for i in range(1, 2 * K + 2):
		prefix[i] += prefix[i - 1]
	ans = float('inf')
	for i in range(1, 2 * K + 2):
		ans = min(ans, prefix[i] + (N // 2 - prefix[i]) * 2 - ma[i])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	k = 2
	sum = 0
	for i in range(n // 2):
		print(k, end=' ')
		sum += k
		k += 2
	k = 1
	sum1 = 0
	for i in range(n // 2, n):
		if i == n - 1:
			print(sum - sum1)
		else:
			print(k, end=' ')
			sum1 += k
			k += 2


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	left = [2 * i for i in range(1, n // 2 + 1)]
	right = [i for i in range(1, n - 1, 2)]
	right.append(sum(left) - sum(right))
	print('YES')
	print(*left, *right)


def balanced_array(n):
	half = n // 2
	if half % 2 == 1:
		return False
	even_part = []
	odd_part = []
	for step in range(half // 2):
		base = step * 10
		even_part.append(base + 2)
		even_part.append(base + 4)
		odd_part.append(base + 1)
		odd_part.append(base + 5)
	return even_part + odd_part
test_cases_number = int(input())
for _ in range(test_cases_number):
	n = int(input())
	result = balanced_array(n)
	if not result:
		print('NO')
		continue
	print('YES')
	print(' '.join(map(str, result)))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		res = list(range(2, n + 1, 2)) + list(range(1, n, 2))
		res[-1] += n // 2
		print('YES')
		print(' '.join(map(str, res)))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	a = [0] * n
	for i in range(n // 2, n):
		a[i] += (i - n // 2) * 2 + 1
	for i in range(n // 2):
		a[i] += i * 2 + 2
	a[n - 1] = sum(a[0:n // 2]) - sum(a[n // 2:-1])
	print('YES')
	print(*a)


def binsearch(a, x):
	left = 0
	right = len(a)
	while right > left + 1:
		mid = (left + right) // 2
		if a[mid][0] > x:
			right = mid
		else:
			left = mid
	return left
t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	a = list(map(int, input().split()))
	count = {}
	ranges = {}
	for i in range(n // 2):
		s = a[i] + a[n - i - 1]
		if s in count:
			count[s] += 1
		else:
			count[s] = 1
		left = min(a[i], a[n - i - 1]) + 1
		right = max(a[i], a[n - i - 1]) + k + 1
		if left in ranges:
			ranges[left] += 1
		else:
			ranges[left] = 1
		if right in ranges:
			ranges[right] -= 1
		else:
			ranges[right] = -1
	runningsum = 0
	partials = []
	for key in sorted(ranges.keys()):
		runningsum += ranges[key]
		partials.append((key, runningsum))
	assert runningsum == 0
	res = n // 2
	for (k, v) in count.items():
		idx = binsearch(partials, k)
		res = min(res, n - partials[idx][1] - v)
	print(res)


for _ in range(int(input())):
	N = int(input())
	if N % 4 == 0:
		print('YES')
		List = []
		First = 0
		count = 2
		for i in range(int(N // 2)):
			List.append(count)
			First += count
			count += 2
		Second = 0
		count = 1
		for j in range(int(N // 2) - 1):
			List.append(count)
			Second += count
			count += 2
		List.append(First - Second)
		print(*List)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	elif n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		odd = 1
		for i in range(n):
			if i + 1 <= n / 2:
				print(2 * (i + 1), end=' ')
				last = 2 * (i + 1)
			else:
				if i + 1 < n:
					print(odd, end=' ')
					odd += 2
				if i == n - 1:
					print(int(last + n / 2 - 1))


def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	l = [2 * i for i in range(1, n // 2 + 1)] + [2 * i + 1 for i in range(1, n // 2 + 1)]
	l[n // 2 - 1] += n // 2
	print(*l)

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


t = int(input())
for g in range(t):
	n = int(input())
	if n % 2 != 0:
		print('NO')
		continue
	g = 2
	A = []
	for i in range(n // 2):
		A.append(g)
		g += 2
	j = n // 2
	f = 1
	l = 0
	sum = 0
	while j < n - 1:
		A.append(f)
		sum += A[l] - f
		l += 1
		f += 2
		j += 1
	sum += A[n // 2 - 1]
	if sum % 2 == 0:
		print('NO')
	elif sum in A:
		print('NO')
	else:
		A.append(sum)
		print('YES')
		print(*A)


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())
import collections as c

def solve():
	N = getInt()
	if N % 4 != 0:
		print('NO')
		return
	arr = [2 * j for j in range(1, N // 2 + 1)] + [2 * j - 1 for j in range(1, N // 2)] + [N - 1 + N // 2]
	print('YES')
	print(*arr)
	return
T = getInt()
for t in range(T):
	solve()


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

def list_input():
	return list(num_input())
for t in range(int(input())):
	n = int(input())
	ans = []
	c = 2
	sum1 = 0
	for i in range(n // 2):
		sum1 += c
		ans.append(c)
		c += 2
	sum2 = 0
	c = 1
	for i in range(n // 2 - 1):
		sum2 += c
		ans.append(c)
		c += 2
	if (sum1 - sum2) % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(i, end=' ')
		print(sum1 - sum2)


for i in range(int(input())):
	aL = int(input())
	n = aL // 2
	sumOfEven = n * (n + 1)
	sumOfOdd = n * n
	if (sumOfEven - sumOfOdd) % 2 == 0:
		print('YES')
		lst = [2 * s for s in range(1, n + 1)]
		olst = [2 * s + 1 for s in range(n)]
		olst[n - 1] = olst[n - 1] + sumOfEven - sumOfOdd
		lst.extend(olst)
		print(*lst)
	else:
		print('NO')


for item in range(int(input())):
	number = int(input())
	if number % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		mass = [(iter + 1) * 2 for iter in range(number // 2)]
		second = []
		avg = sum(mass) // len(mass)
		for iter in mass:
			if iter < avg:
				second.append(iter - 1)
			else:
				second.append(iter + 1)
		print(*mass + second)


import sys
from math import *
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize
sys.setrecursionlimit(10 ** 7)
mod = 1000000007

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

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		if n // 2 % 2 == 0:
			ans = list(range(1, n + 1))
			even = [i for i in ans if not i & 1]
			odd = [i for i in ans if i & 1]
			res = []
			res.extend(even)
			odd[-1] += n // 2
			res.extend(odd)
			print('YES')
			print(*res)
		else:
			print('NO')
try:
	IOE()
except:
	pass
main()


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):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	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, k) = int_array()
	a = int_array()
	sum_a = {}
	minmax = [0] * (2 * k + 2)
	for i in range(n // 2):
		(ind1, ind2) = (a[i], a[n - i - 1])
		sum_a[ind1 + ind2] = sum_a.get(ind1 + ind2, 0) + 1
		mini = min(ind1, ind2) + 1
		maxi = max(ind1, ind2) + k
		minmax[mini] += 1
		minmax[maxi + 1] -= 1
	for i in range(1, len(minmax)):
		minmax[i] += minmax[i - 1]
	minmax = minmax[:-1]
	ans = INF
	for sum_ans in range(2, 2 * k + 1):
		zeros = sum_a.get(sum_ans, 0)
		ones = minmax[sum_ans] - zeros
		twos = n // 2 - (zeros + ones)
		this_ans = ones + 2 * twos
		ans = min(ans, this_ans)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ev = []
		od = []
		for j in range(1, n // 2):
			ch = 2 * j
			ev.append(ch)
			od.append(ch - 1)
		ev.append(2 * (n // 2))
		od.append(2 * (n // 2) + n // 2 - 1)
		print(' '.join(map(str, ev)), ' '.join(map(str, od)))


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		n = int(n / 2)
		even_sum = n * (n + 1)
		odd_sum = (n - 1) ** 2
		diff = even_sum - odd_sum
		print('YES')
		for i in range(1, n + 1):
			print(2 * i, end=' ')
		for i in range(1, n):
			print(2 * i - 1, end=' ')
		print(diff)
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	sumFreq = []
	pref = []
	for i in range(2 * k + 2):
		pref.append(0)
		sumFreq.append(0)
	i = 0
	j = n - 1
	x = n // 2
	while x > 0:
		x -= 1
		s = a[i] + a[j]
		sumFreq[s] += 1
		p = k - min(a[i], a[j])
		q = max(a[i], a[j]) - 1
		r = [s - q, p + s]
		pref[r[0]] += 1
		pref[r[1] + 1] -= 1
		i += 1
		j -= 1
	for i in range(3, 2 * k + 1):
		pref[i] += pref[i - 1]
	ans = 1000000000.0
	for i in range(2, 2 * k + 1):
		ans = min(ans, pref[i] - sumFreq[i] + 2 * (n // 2 - pref[i]))
	print(ans)


from typing import OrderedDict
a = int(input())
for i in range(a):
	b = int(input())
	if b % 4 != 0:
		print('NO')
	else:
		print('YES')
		(empe, empo) = ([], [])
		for i in range(1, b // 2 + 1):
			empe.append(2 * i)
		even = sum(empe)
		for j in range(1, b // 2):
			empo.append(2 * j - 1)
		odd = sum(empo)
		emp = empe + empo
		emp.append(even - odd)
		for k in range(len(emp)):
			print(emp[k], end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	n //= 2
	if n % 2:
		print('NO')
	else:
		print('YES')
		ans = list()
		for j in range(1, n + 1):
			ans.append(j * 2)
		ans.append(n - 1 + ans[-1])
		for j in range(1, n):
			ans.append(j * 2 - 1)
		print(*ans)


for _ in range(int(input())):
	a = int(input())
	mid = int(a / 2)
	if mid % 2 != 0:
		print('NO')
	else:
		print('YES')
		oddlist = []
		evenlist = []
		(even, odd, left, right) = (0, 1, 0, 1)
		oddlist.append(odd)
		for i in range(mid):
			even = even + 2
			evenlist.append(even)
			left = even + left
			if i < mid - 2:
				odd = odd + 2
				oddlist.append(odd)
				right = right + odd
		last_element = left - right
		oddlist.append(last_element)
		print(*evenlist, *oddlist)


arr = [[], []]

def out1(x, n, m):
	if x <= 0:
		return True
	if n <= 0:
		if x - 10 * m > 0:
			return False
		else:
			return True
	if m <= 0:
		return False
	return out1(x // 2 + 10, n - 1, m) or out1(x - 10, n, m - 1)

def out(x):
	if x % 4 != 0:
		print('NO')
		return
	print('YES')
	li = [i for i in range(1, x + 2) if i != x / 2 + 1]
	for i in li:
		if i % 2 == 0:
			print(i, end=' ')
	for i in li:
		if i % 2 != 0:
			print(i, end=' ')
	print()
for i in range(int(input())):
	x = int(input())
	out(x)


import bisect

def main():
	t = int(input())
	for _ in range(t):
		line = input().split()
		(n, k) = (int(line[0]), int(line[1]))
		nums = list(map(int, input().split()))
		dic = {}
		min_ = []
		max_ = []
		for i in range(n // 2):
			dic[nums[i] + nums[n - i - 1]] = dic.get(nums[i] + nums[n - i - 1], 0) + 1
			min_.append(min(nums[i], nums[n - i - 1]))
			max_.append(max(nums[i], nums[n - i - 1]))
		min_.sort()
		max_.sort()
		m = len(min_)
		ans = m
		for key in dic:
			res = 0
			left = bisect.bisect_left(max_, key - k)
			res += left * 2
			right = bisect.bisect_right(min_, key - 1)
			res += (m - right) * 2
			res += m - left - (m - right) - dic[key]
			ans = min(ans, res)
		print(ans)
main()


n = int(input())
for i in range(n):
	a = int(input())
	a = a // 2
	if a % 2 == 1:
		print('NO')
	else:
		print('YES')
		result_even = []
		result_odd = []
		for j in range(a):
			result_even.append(str(j * 2 + 2))
			if j < a / 2:
				result_odd.append(str(j * 2 + 1))
			else:
				result_odd.append(str(j * 2 + 3))
		print(' '.join(result_even + result_odd))


import sys

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		if n // 2 % 2:
			print('NO')
		else:
			print('YES')
			evens = [(i + 1) * 2 for i in range(n // 2)]
			odds = [(i + 1) * 2 - 1 for i in range(n // 2)]
			odds[-1] += n // 2
			print(' '.join(map(str, evens + odds)))
main()


n = int(input())
for i in range(n):
	num = int(input())
	if num / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		init = 2
		for i in range(int(num / 2)):
			l.append(init)
			init += 2
		ll = len(l)
		i = 0
		new = []
		while i < ll - 1:
			new.append(l[i] - 1)
			i += 1
		new.append(sum(l) - sum(new))
		for num in new:
			l.append(num)
		ans = ''
		for num in l:
			ans += str(num) + ' '
		ans = ans[:-1]
		print(ans)


t = int(input())
for i in range(t):
	a = []
	n = int(input())
	add = 0
	for _ in range(int(n / 2)):
		add += 2
		a.append(add)
	possible_nums = [1]
	for num in a:
		possible_nums.append(num + 1)
	total = []
	for j in range(len(possible_nums)):
		if len(total) < len(a) - 1:
			total.append(possible_nums[j])
		else:
			if len(a) != len(total) and (sum(a) - sum(total)) % 2 != 0:
				total.append(sum(a) - sum(total))
			if sum(a) == sum(total) and len(a) == len(total):
				print('YES')
				result = []
				for k in a:
					result.append(str(k))
				for k in total:
					result.append(str(k))
				result = ' '.join(result)
				print(result)
				break
			else:
				print('NO')
				break


import sys
import bisect
from collections import Counter
input = lambda : sys.stdin.readline().strip()
t = int(input())

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pref = [0] * (2 * k + 2)
	cnt = [0] * (2 * k + 1)
	for i in range(n // 2):
		mi = min(a[i], a[n - 1 - i])
		ma = max(a[i], a[n - 1 - i])
		pref[mi + 1] += 1
		pref[ma + k + 1] -= 1
		cnt[a[i] + a[n - 1 - i]] += 1
	for i in range(2, 2 * k + 1):
		pref[i] += pref[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		ans = min(ans, pref[i] - cnt[i] + (n // 2 - pref[i]) * 2)
	print(ans)
while t:
	t -= 1
	solve()


def solve():
	n = int(input())
	if n == 2:
		print('NO')
		return
	if n % 4 != 0:
		print('NO')
		return
	else:
		ans = []
		even = 2
		odd = 1
		k = 0
		while k < n:
			if k < n // 2:
				ans.append(even)
				even += 2
				k += 1
			else:
				ans.append(odd)
				odd += 2
				k += 1
		ans[n - 1] += n // 2
		print('YES')
		print(*ans)
		return
try:
	for _ in range(int(input())):
		solve()
except:
	pass


for _ in range(int(input())):
	N = int(input())
	if N // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		A = [2]
		z = 2
		for i in range(1, N // 2):
			A.append(A[i - 1] + 2)
			z += A[i - 1] + 2
		A.append(1)
		y = 1
		for i in range(N // 2 + 1, N - 1):
			A.append(A[i - 1] + 2)
			y += A[i - 1] + 2
		A.append(z - y)
		print(*A)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		m = n // 2
		if m % 2 > 0:
			print('NO')
		else:
			print('YES')
			l = [2 * (i + 1) for i in range(m)]
			ls = m * (m + 1)
			r = [2 * i + 1 for i in range(m)]
			rs = m * (m + 1) - m
			r[-1] += ls - rs
			ans = l + r
			print(' '.join((str(i) for i in ans)))
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		ln = n // 2
		l = 0
		ax = []
		bx = []
		i = 1
		while l < ln:
			a = i
			b = i + 1
			ax.append(b)
			bx.append(a)
			i = i + 3
			a = i
			b = i + 1
			ax.append(a)
			bx.append(b)
			i = i + 3
			l += 2
		ls = ax + bx
		for x in ls:
			print(x, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for i in range(t):
	e = 2
	o = 1
	s = 0
	ch = ''
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		L = [0 for i in range(n)]
		for j in range(n // 2):
			L[j] = e
			e += 2
			s += L[j]
		for j in range(n // 2, n - 1):
			L[j] = o
			o += 2
			s -= L[j]
		L[n - 1] = s
		print('YES')
		for i in range(len(L)):
			print(L[i])


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		c = 2
		for i in range(n // 2):
			print(c, end=' ')
			c += 2
		c = 1
		for j in range(n // 2 - 1):
			print(c, end=' ')
			c += 2
		print(c + n // 2)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	z = [0 for i in range(2 * k + 1)]
	z1 = list(z)
	f = list(z)
	for i in range(ceil(n // 2)):
		a = l[i]
		b = l[n - i - 1]
		z[min(a, b) + 1] += 1
		z1[max(a, b) + k] += 1
		f[a + b] += 1
	m = 2 * (n // 2)
	if n % 2 == 0:
		for i in range(2, len(z)):
			m -= z[i]
			z[i] = m - f[i]
			m += z1[i]
	else:
		x = 2 * l[n // 2]
		for i in range(2, len(z)):
			m -= z[i]
			z[i] = m - f[i]
			m += z1[i]
			if x == i:
				pass
			elif i % 2 != 0:
				z[i] = float('infinity')
			else:
				z[i] += 1
	print(min(z[2:]))


for iiii in range(int(input())):
	x = 0
	y = 0
	x1 = 0
	y1 = 0
	x += 1
	y += 1
	x1 += 1
	y1 += 1
	inppppp = int(input())
	x = 0
	y = 0
	x1 = 0
	y1 = 0
	x += 1
	y += 1
	x1 += 1
	y1 += 1
	suuuu = 0
	s22222 = 0
	x = 0
	y = 0
	x1 = 0
	y1 = 0
	x += 1
	y += 1
	x1 += 1
	y1 += 1
	if inppppp // 2 % 2 != 0:
		print('NO')
		x = 0
		y = 0
		x1 = 0
		y1 = 0
		x += 1
		y += 1
		x1 += 1
		y1 += 1
	else:
		x = 0
		y = 0
		x1 = 0
		y1 = 0
		x += 1
		y += 1
		x1 += 1
		y1 += 1
		print('YES')
		c = 1
		x = 0
		y = 0
		x1 = 0
		y1 = 0
		x += 1
		y += 1
		x1 += 1
		y1 += 1
		for j in range(2, 100000000000000, 2):
			c += 1
			x = 0
			y = 0
			x1 = 0
			y1 = 0
			x += 1
			y += 1
			x1 += 1
			y1 += 1
			print(j, end=' ')
			suuuu += j
			x = 0
			y = 0
			x1 = 0
			y1 = 0
			x += 1
			y += 1
			x1 += 1
			y1 += 1
			if c == inppppp // 2 + 1:
				break
		for j in range(1, 10000000000000000, 2):
			c += 1
			x = 0
			y = 0
			x1 = 0
			y1 = 0
			x += 1
			y += 1
			x1 += 1
			y1 += 1
			print(j, end=' ')
			s22222 += j
			x = 0
			y = 0
			x1 = 0
			y1 = 0
			x += 1
			y += 1
			x1 += 1
			y1 += 1
			if c == inppppp:
				break
		print(suuuu - s22222)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		val = n // 2
		c = 2
		li = []
		s = 0
		for i in range(val):
			s += c
			li.append(c)
			c += 2
		c = 1
		s2 = 0
		for i in range(val - 1):
			s2 += c
			li.append(c)
			c += 2
		li.append(s - s2)
		print(*li)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr1 = list(range(2, n + 1, 2))
		arr2 = list(range(1, n + 1, 2))
		arr2[-1] = arr2[-1] + n // 2
		arr = arr1 + arr2
		for i in arr:
			print(i, end=' ')


for _ in range(int(input())):
	a = int(input())
	if a % 4 == 0:
		print('YES')
		ev = 0
		od = -1
		lis = []
		lod = []
		for i in range(int(a / 2)):
			ev = ev + 2
			lis.append(ev)
			print(ev, end=' ')
		for i in range(int(a / 2) - 1):
			od = od + 2
			lod.append(od)
			print(od, end=' ')
		print(sum(lis) - sum(lod))
	else:
		print('NO')


t = int(input())
a1 = []
a2 = []
for i in range(1, 100000):
	i4 = i * 8
	a1.append(i4)
	a1.append(i4 - 2)
	a2.append(i4 + 1)
	a2.append(i4 - 3)
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, a1[:n // 2] + a2[:n // 2])))


def solution():
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		l = []
		print('YES')
		x = 0
		y = -1
		for i in range(n // 2):
			x += 2
			l.append(x)
		se = sum(l)
		for i in range(n // 2 - 1):
			y += 2
			l.append(y)
		so = sum(l[n // 2:])
		l.append(se - so)
		print(*l)
for _ in range(int(input())):
	solution()


for i in range(int(input())):
	curOffset = 1
	curLimitOffest = 1
	curOffsetCounter = 0
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	evenList = [i * 2 for i in range(1, n // 2 + 1)]
	oddList = []
	for i in range(n // 4):
		a1 = evenList[2 * i]
		a2 = evenList[2 * i + 1]
		oddList.append(a1 - curOffset)
		oddList.append(a2 + curOffset)
		curOffsetCounter += 1
		if curOffsetCounter == curLimitOffest:
			curOffset += 2
			curOffsetCounter = 0
			curLimitOffest += 1
	print('YES')
	print(*evenList, *oddList)


t = int(input())
inp = [0] * t
for i in range(t):
	inp[i] = int(input())
a1 = [2]
a2 = [1]
for n in inp:
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	while len(a1) < n // 2:
		i = len(a1) - 1
		if i % 2 == 0:
			a1.append(a1[i] + 2)
			a2.append(a1[i + 1] + 1)
		else:
			a2.append(a2[i] + 2)
			a1.append(a2[i + 1] + 1)
	for i in range(n // 2):
		print(a1[i], end=' ')
	for i in range(n // 2):
		print(a2[i], end=' ')
	print()


from collections import Counter
from itertools import accumulate
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	counter = Counter()
	for i in range(n // 2):
		counter[arr[i] + arr[n - i - 1]] += 1
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		left = min(arr[i], arr[n - i - 1]) + 1
		right = max(arr[i], arr[n - i - 1]) + k
		pref[left] += 1
		pref[right + 1] -= 1
	pref = list(accumulate(pref))
	ans = 1000000000.0
	for i in range(2, 2 * k + 1):
		ans = min(ans, pref[i] - counter[i] + (n // 2 - pref[i]) * 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	el = []
	ol = []
	c = 2
	while n > 2:
		el.append(c)
		ol.append(c - 1)
		c += 2
		n -= 2
	el.append(c)
	d = sum(el) - sum(ol)
	if d % 2 == 0:
		print('NO')
	else:
		print('YES')
		ol.append(d)
		print(' '.join(map(str, el + ol)))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 != 0 or n // 2 % 2 != 0:
		print('NO')
	else:
		c0 = [i for i in range(2, n + 1, 2)]
		c1 = [i for i in range(1, n + 1, 2)]
		c1[n // 2 - 1] += n // 2
		print('YES')
		a = c0 + c1
		for i in range(n - 1):
			print(a[i], end=' ')
		print(a[-1])


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	if n % 4 == 0:
		print('YES')
		for x in range(1, n // 2 + 1):
			print(2 * x, end=' ')
		for y in range(1, n - 1):
			if y % 2 == 1:
				print(y, end=' ')
		print(n + n // 2 - 1, end=' ')
		print()
	else:
		print('NO')


t = int(input())
while t:
	x = int(input())
	if x // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = [0] * x
		y1 = 100000000
		y2 = 2
		for i in range(0, x // 2, 2):
			a[i] = y2
			a[i + x // 2] = y2 + 1
			y2 += 2
		for i in range(1, x // 2, 2):
			a[i] = y1
			a[i + x // 2] = y1 - 1
			y1 -= 2
		for g in a:
			print(g, end=' ')
		print()
	t -= 1


for _ in range(int(input())):
	m = int(input())
	if m % 4 != 0:
		print('No')
	else:
		print('yes')
		k = []
		for i in range(2, m + 1, 2):
			print(i, end=' ')
			k.append(i - 1)
		k[-1] += m // 2
		print(*k)


for i in range(int(input())):
	n = int(input())
	mid = n // 2
	na = [i for i in range(2, n + 1, 2)]
	pa = []
	p = 1
	for i in range(mid - 1):
		pa.append(p)
		p += 2
	na = na + pa + [sum(na) - sum(pa)]
	if na[-1] % 2 == 0:
		print('NO')
	else:
		print('YES')
		print(*na)


t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 == 0:
		half = n // 2
		a = []
		(e, o) = (2, 1)
		for i in range(half):
			a.append(e)
			e += 2
		for i in range(half, n):
			a.append(o)
			o += 2
		evenHalf = a[:half]
		oddHalf = a[half:]
		a[-1] += abs(sum(evenHalf) - sum(oddHalf))
		print('YES')
		print(' '.join(list(map(str, a))))
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l1 = [x for x in range(2, n + 1, 2)]
		l2 = [x for x in range(1, n - 1, 2)]
		l2.append(sum(l1) - sum(l2))
		l = l1 + l2
		for j in range(n):
			print(l[j], end=' ')
		print()


t = int(input())
while t > 0:
	n = int(input())
	half = int(n / 2)
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, half + 1):
			print(f'{i * 2} ', end='')
		for i in range(1, half):
			print(f'{i * 2 - 1} ', end='')
		print(f'{3 * half - 1} ', end='')
		print()
	t -= 1


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

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(r()[0]):
	a = r()[0]
	if a % 4:
		print('NO')
	else:
		print('YES')
		s = 0
		for i in range(2, a + 1, 2):
			print(i, end=' ')
			s += i
		for i in range(1, a - 1, 2):
			print(i, end=' ')
			s -= i
		print(s)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		arr = [0] * n
		for i in range(n):
			if i < n // 2:
				arr[i] = 2 * (i + 1)
			else:
				arr[i] = 1 + 2 * (i - n // 2)
		arr[n - 1] += n // 2
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		num = int(n / 2)
		ans1 = list(range(2, 2 * num + 1, 2))
		ans2 = []
		r = 1
		for i in range(0, num - 1):
			ans2.append(2 * i + 1)
		ans2.append(sum(ans1) - sum(ans2))
		for x in ans1 + ans2:
			print(str(x), end=' ')


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


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	cnt = [0] * (2 * k + 1)
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		cnt[arr[i] + arr[n - 1 - i]] += 1
		pref[min(arr[i], arr[n - 1 - i]) + 1] += 1
		pref[max(arr[i], arr[n - 1 - i]) + k + 1] -= 1
	for i in range(1, 2 * k + 2):
		pref[i] += pref[i - 1]
	mn = 1000000000.0
	for i in range(2, 2 * k + 1):
		mn = min(mn, (n // 2 - pref[i]) * 2 + pref[i] - cnt[i])
	print(mn)


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		a = []
		for i in range(1, n // 2 + 1):
			a.append(i * 2)
		t = sum(a)
		b = []
		for i in range(1, 2 * t, 2):
			b.append(i)
			if len(b) == len(a) - 1:
				break
		p = sum(b)
		for i in range(b[len(a) - 2] + 2, 2 * t, 2):
			if p + i < t:
				pass
			elif p + i == t:
				print('YES')
				b.append(i)
				break
		for i in a:
			print(i, end=' ')
		for i in b:
			print(i, end=' ')
		print()


import math
for _ in range(int(input())):
	n = int(input())
	a = [0] * n
	if n % 4 != 0:
		print('NO')
		continue
	a[0] = 2
	for i in range(1, n // 2):
		if i % 2:
			a[i] = a[i - 1] + 2
		else:
			a[i] = a[i - 1] + 4
	a[n // 2] = 1
	for i in range(n // 2 + 1, n):
		if (i - n // 2) % 2:
			a[i] = a[i - 1] + 4
		else:
			a[i] = a[i - 1] + 2
	print('YES')
	print(*a)


def intpow(a, n):
	ans = 1
	while n > 0:
		if n & 1:
			ans = ans * a
		a = a * a
		n = n >> 1
	return ans
for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		k = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			k += i
		j = 1
		ans = 0
		for i in range(1, n // 2 + 1):
			if i == n // 2:
				print(k - ans)
			else:
				print(j, end=' ')
				ans += j
				j += 2


times = int(input())
for i in range(times):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for p in range(2, n + 1, 2):
			print(p, end=' ')
		for q in range(1, n - 1, 2):
			print(q, end=' ')
		print(int(n + (n - 2) / 2))


from bisect import bisect, bisect_left, bisect_right

def solve():
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	ocr = {}
	mpv = [None] * (n // 2)
	spv = [None] * (n // 2)
	for i in range(n // 2):
		x = ar[i] + ar[n - i - 1]
		mpx = max(ar[i], ar[n - i - 1]) + k
		spx = min(ar[i], ar[n - i - 1]) + 1
		spv[i] = spx
		mpv[i] = mpx
		if x in ocr:
			ocr[x] += 1
		else:
			ocr[x] = 1
	mpv.sort()
	spv.sort()
	items = [(v, k) for (k, v) in ocr.items()]
	items.sort()
	items.reverse()
	best = n // 2
	for (ocr, x) in items:
		over = bisect_left(mpv, x, 0, len(mpv))
		under = n // 2 - bisect_right(spv, x, 0, len(spv))
		cur = n // 2 - ocr + over + under
		if cur < best:
			best = cur
	print(best)
t = int(input())
for _ in range(t):
	solve()


test_case = int(input())
for _ in range(test_case):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		res = []
		for i in range(0, n // 2):
			res.append((i + 1) * 2)
		for i in range(1, n // 2):
			res.append(2 * i - 1)
		temp = n // 4
		num = (int(res[len(res) - 1]) + 1) // 2
		temp = num + temp
		res.append(2 * temp + 1)
		print(' '.join((str(x) for x in res)))


import sys, bisect
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(l, r, m) = ([], [], [0] * (2 * k + 1))
	for i in range(n >> 1):
		(x, y) = (a[i], a[n - i - 1])
		if x > y:
			(x, y) = (y, x)
		l.append(x + 1)
		r.append(y + k + 1)
		m[x + y] -= 1
	(l, r, n) = ([2] + sorted(l), sorted(r) + [2 * k + 1], n >> 1)
	for i in range(n):
		t = n - i
		for j in range(l[i], l[i + 1]):
			m[j] += t
		for j in range(r[i], r[i + 1]):
			m[j] += i + 1
	print(min(m[2:]) + n)


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		print(*[i * 2 + 2 for i in range(n // 2)], *[i * 2 + 1 for i in range(n // 2 - 1)], n + n // 2 - 1)


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

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

def main():

	def solve():
		n = int(input())
		if n % 4 != 0:
			print('NO')
			return
		sum = 0
		aa = list(range(2, n + 2, 2)) + list(range(1, n - 1, 2)) + [n + n // 2 - 1]
		print('YES')
		print(' '.join(map(str, aa)))
	q = int(input())
	for _ in range(q):
		solve()
main()


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	n = read_int()
	half = n // 2
	if half % 2 == 1:
		print('NO')
		return
	answer = []
	for i in range(half):
		answer.append((i + 1) * 2)
	for i in range(half):
		answer.append(2 * i + 1)
	answer[-1] += half
	print('YES')
	print(' '.join(map(str, answer)))
T = read_int()
for _ in range(T):
	solve()


def call():
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
		return
	print('YES')
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for i in range(1, n):
		print(i * 2 - 1, end=' ')
	print(3 * n - 1)
for _ in range(int(input())):
	call()


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	hol = []
	jak = []
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(n // 2):
			jak.append(2 * (i + 1))
		for j in range(n // 2 - 1):
			hol.append(2 * (j + 1) - 1)
		hol.append(sum(jak) - sum(hol))
		for i in jak:
			print(i, end=' ')
		for i in hol:
			print(i, end=' ')
		print()
	else:
		print('NO')


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		a = [2 * i for i in range(1, n // 2 + 1)]
		b = [2 * i + 1 for i in range(n // 2)]
		b[-1] += n // 2
		print(*a, *b)


T = int(input())
for t in range(T):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = [0] * n
		for i in range(int(n / 2)):
			ans[i] = (i + 1) * 2
		s = sum(ans)
		tmp = 0
		for i in range(int(n / 2), n - 1):
			ans[i] = int(i - n / 2) * 2 + 1
			tmp += ans[i]
		ans[-1] = s - tmp
		print(' '.join([str(x) for x in ans]))


t = int(input())
for _ in range(t):
	n = int(input())
	p = n // 2
	if p % 2 == 0:
		print('YES')
		even = []
		odd = []
		j = 2
		k = 1
		for i in range(p):
			even.append(j)
			odd.append(k)
			k += 2
			j += 2
		p = sum(even)
		k = sum(odd)
		j = odd[len(odd) - 1]
		j = k - j
		p = p - j
		odd[len(odd) - 1] = p
		even = even + odd
		print(*even)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		s = 0
		e = 0
		for i in range(n // 2):
			e += 2
			s += e
			print(e, end=' ')
		k = 1
		s1 = 0
		for i in range(n // 2, n - 1):
			s1 += k
			print(k, end=' ')
			k += 2
		l = s - s1
		print(l)
	else:
		print('NO')


from bisect import bisect_right, bisect_left
a = int(input())
for i in range(a):
	(n, k) = map(int, input().split())
	z = list(map(int, input().split()))
	from collections import defaultdict
	al = defaultdict(int)
	mini = []
	maxa = []
	for i in range(len(z) // 2):
		al[z[i] + z[n - i - 1]] += 1
		mini.append(1 + min(z[i], z[n - i - 1]))
		maxa.append(k + max(z[i], z[n - i - 1]))
	count = 0
	for i in range(len(z) // 2):
		if z[i] + z[n - i - 1] == k + 1:
			continue
		if mini[i] <= k + 1 <= maxa[i]:
			count += 1
		else:
			count += 2
	ans = count
	mini.sort()
	maxa.sort()
	for i in range(1, 2 * k + 1):
		if i < k + 1:
			t = bisect_right(mini, i)
			ans = min(ans, t + (len(mini) - t) * 2 - al[i])
		elif i > k + 1:
			t = bisect_left(maxa, i)
			ans = min(ans, len(maxa) - t + 2 * t - al[i])
	print(ans)
mini = []
maxa = []


t = int(input())
import random
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = [0] * (k + 1)
	e = [0] * (k + 1)
	d = {}
	for i in range(n // 2):
		c[min(l[i], l[n - 1 - i])] += 1
		e[max(l[i], l[n - 1 - i])] += 1
		try:
			d[l[i] + l[n - 1 - i]] += 1
		except:
			d[l[i] + l[n - 1 - i]] = 1
	for i in range(1, k + 1):
		c[i] += c[i - 1]
		e[i] += e[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		if i <= k:
			x = c[i - 1]
		else:
			x = e[k] - e[i - k - 1]
		try:
			x = x - d[i]
		except:
			pass
		if i > k:
			x = x + (n // 2 - e[k] + e[i - k - 1]) * 2
		else:
			x = x + (n // 2 - c[i - 1]) * 2
		ans = min(ans, x)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(n + n // 2 - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		for k in range(n // 2):
			ans.append((k + 1) * 2)
		for k in range(n // 2 - 1):
			ans.append((k + 1) * 2 - 1)
		ans.append(n // 2 - 1 + n)
		print(*ans)


t = int(input())
z = []

def oddIntegers(n, k):
	if n % 2 != k % 2:
		z.append('NO')
		return
	else:
		z.append('YES')
		sum = 0
		i = 1
		j = 1
		while j < k:
			sum += i
			a.append(i)
			i += 2
			j += 1
		finalOdd = n - sum
		a.append(finalOdd)
zz = []
for ii in range(t):
	c = 0
	n = int(input())
	if n == 2:
		z.append('NO')
	else:
		a = []
		s = 0
		ss = n // 2
		for i in range(2, n + 1, +2):
			s = s + i
			a.append(i)
		oddIntegers(s, ss)
		if z[ii] == 'YES':
			zz.append(a)
b = 0
for i in z:
	if i == 'NO':
		print('NO')
	elif i == 'YES':
		print('YES')
		for ii in zz[b]:
			print(ii, end=' ')
		print()
		b += 1


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		tmp = 2
		for j in range(int(n / 2)):
			print(tmp, end=' ')
			tmp += 2
		sum_1st_half = (j + 1) * (j + 2)
		tmp = 1
		for j in range(int(n / 2) - 1):
			print(tmp, end=' ')
			tmp += 2
		sum_2nd_half = (j + 1) * (j + 1)
		print(sum_1st_half - sum_2nd_half)
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		if n % 4 != 0:
			print('NO')
			continue
		sol = [0] * n
		sol[0] = 2
		sol[n // 2] = 3
		o = True
		for i in range(1, n // 2):
			sol[i] = sol[i - 1] + 4
			x = 2 if o else 6
			sol[n // 2 + i] = sol[n // 2 + i - 1] + x
			o = not o
		print('YES')
		print(*sol)
main()


for _ in range(int(input())):
	s = int(input())
	if s % 4 != 0:
		print('NO')
	else:
		a = [i for i in range(2, s + 1, 2)]
		a.extend([i for i in range(1, s, 2)])
		a[-1] += s // 2
		print('YES')
		print(*a)


for j in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		s = ''
		summ = 0
		for i in range(1, n):
			if i <= n // 2:
				s += str(2 * i) + ' '
				summ += 2 * i
			else:
				s += str(2 * (i - n // 2) - 1) + ' '
				summ -= 2 * (i - n // 2) - 1
		print(s + str(summ))


t = int(input())
while t:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = [int(2 * i) for i in range(1, int(n / 2) + 1)]
		s = sum(a)
		su = 0
		for i in range(len(a) - 1):
			a.append(a[i] - 1)
			su += a[i] - 1
		a.append(s - su)
		for i in range(len(a) - 1):
			print(a[i], end=' ')
		print(a[n - 1])
	t -= 1


n = int(input())
for j in range(n):
	t = int(input())
	if t % 4 != 0:
		print('NO')
	else:
		a = [0] * t
		for i in range(t):
			if i < t / 2:
				a[i] += 2 * (i + 1)
			elif t / 2 <= i < t - 1:
				a[i] += 2 * i + 1 - t
			else:
				a[i] += int(1.5 * t - 1)
		print('YES')
		print(*a)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		su = 0
		j = 0
		for i in range(n // 2):
			j += 2
			print(j, end=' ')
			su += j
		su1 = 0
		j = -1
		for i in range(n // 2, n - 1):
			j += 2
			print(j, end=' ')
			su1 += j
		print(su - su1)


for tt in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO', end='')
	else:
		(l, e, o, p) = ([], 2, 1, 0)
		while p < n / 2:
			l.append(e)
			e += 2
			p += 1
		(sm, smo, lo) = (sum(l), 0, [])
		while smo < sm:
			lo.append(o)
			smo += o
			o += 2
		if (smo - sm) % 2 == 0 or smo - sm not in lo:
			print('NO', end='')
		else:
			lo.remove(smo - sm)
			print('YES')
			for i in l:
				print(i, end=' ')
			for i in lo:
				print(i, end=' ')
	print()


def main():
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		(mass, mass2) = ([x for x in range(2, n // 2 * 2 + 1, 2)], [x for x in range(1, n // 2 * 2 - 1, 2)])
		print(*mass, *mass2, sum(mass) - sum(mass2))
	else:
		print('NO')
for x in range(int(input())):
	main()


for _ in range(int(input())):
	n = int(input())
	x = 1
	sum = 0
	if n / 2 % 2 == 0:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(1, n // 2):
			print(x, end=' ')
			x = x + 2
		y = n // 2
		print(y * (2 + (y - 1)) - (y - 1) * (1 + (y - 2)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		sumEven = 0
		sumOdd = 0
		for i in range(1, n, 2):
			l.append(i + 1)
			sumEven += i + 1
		for i in range(1, n - 2, 2):
			l.append(i)
			sumOdd += i
		l.append(sumEven - sumOdd)
		print(' '.join(map(str, l)))


tc = int(input())
for t in range(tc):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		s = 1
		left = []
		right = set()
		for i in range(1, n // 2 + 1):
			left.append(i * 2)
		for i in range(0, n // 2, 2):
			tot = left[i] + left[i + 1]
			while s in right:
				s += 2
			right.add(s)
			right.add(tot - s)
		print(*left + list(right))


T = int(input())
for j in range(T):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		x = a // 2 * (a // 2 + 1)
		for i in range(2, a + 1, 2):
			print(i, end=' ')
		for i in range(1, a - 1, 2):
			x -= i
			print(i, end=' ')
		print(x)


T = int(input())
for _ in range(T):
	n = int(input())
	l = []
	if n % 4 != 0:
		print('NO')
	else:
		for i in range(2, n + 1, 2):
			l.append(i)
		for j in range(1, n - 1, 2):
			l.append(j)
		l.append(l[-1] + 2 + n // 2)
		print('YES')
		l = [str(i) for i in l]
		x = ' '.join(l)
		print(x)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = []
		for i in range(1, n // 2 + 1):
			e.append(i * 2)
		for i in range(1, n // 2):
			e.append(2 * i - 1)
		e.append(3 * (n // 2) - 1)
		print(' '.join(map(str, e)))


from collections import deque
from collections import OrderedDict
import math
maxValue = 2 * 100000 + 2
for t in range(int(input())):
	(n, k) = map(int, input().split())
	arrIn = input().split()
	dp = [0] * (2 * max(k + 1, n + 1))
	dp1 = [0] * (2 * max(k + 1, n + 1))
	for i in range(len(arrIn)):
		arrIn[i] = int(arrIn[i])
	for i in range(len(arrIn) // 2):
		x = arrIn[i]
		y = arrIn[len(arrIn) - i - 1]
		dp[2] += 2
		dp[min(x, y) + 1] -= 2
		dp[min(x, y) + 1] += 1
		dp[x + y] -= 1
		dp[x + y + 1] += 1
		dp[max(x, y) + k + 1] -= 1
		dp[max(x, y) + k + 1] += 2
	for i in range(1, k * 2 + 1):
		dp1[i] = dp1[i - 1] + dp[i]
	answer = maxValue
	for i in range(2, k * 2 + 1):
		answer = min(answer, dp1[i])
	print(answer)


for _ in range(int(input())):
	sum = 0
	n = int(input())
	l_even = []
	even = 2
	for i in range(0, n // 2):
		l_even.append(even)
		sum += even
		even += 2
	l_odd = []
	odd = 1
	for i in range(0, n // 2 - 1):
		l_odd.append(odd)
		sum -= odd
		odd += 2
	if sum & 1:
		l_odd.append(sum)
		print('YES')
		print(*l_even, *l_odd)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		li = []
		for i in range(1, k + 1):
			li.append(i * 2)
		for i in range(k):
			li.append(li[i] - 1)
		li[-1] = li[-1] + k
		print(*li)


a = int(input())
for k in range(a):
	b = int(input())
	if b % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = [k for k in range(2, b + 1, 2)]
		o = [k for k in range(1, b + 1, 2)]
		o[-1] += b // 2
		for j in e:
			print(j, end=' ')
		for j in o:
			print(j, end=' ')
		print()


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


cases = int(input())
for _ in range(cases):
	n = int(input())
	if n == 2:
		print('NO')
	else:
		w = []
		x = list(range(1, n + 1))
		for i in range(1, len(x), 2):
			w.append(x[i])
		q = sum(w)
		g = []
		for i in range(0, len(x) - 2, 2):
			g.append(x[i])
		if (q - sum(g)) % 2 == 0:
			print('NO')
		else:
			g.append(q - sum(g))
			print('YES')
			print(*w + g)


t = int(input())

def oco(l):
	d = {}
	for el in l:
		if el in d:
			d[el] += 1
		else:
			d[el] = 1
	return d
for test in range(t):
	(n, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	psum = [a[i] + a[n - i - 1] for i in range(len(a) // 2)]
	pmax = [k + max(a[i], a[n - i - 1]) for i in range(len(a) // 2)]
	pmax.sort()
	pmin = [1 + min(a[i], a[n - i - 1]) for i in range(len(a) // 2)]
	pmin.sort()
	di = oco(psum)
	itma = 0
	itmi = 0
	ans = [0 for i in range(2 * k - 1)]
	for i in range(len(ans)):
		while itma < len(pmax):
			if pmax[itma] >= i + 2:
				break
			itma += 1
		while itmi < len(pmin):
			if pmin[itmi] > i + 2:
				break
			itmi += 1
		ans[i] = n + itma - itmi
		if i + 2 in di:
			ans[i] -= di[i + 2]
	print(min(ans))


import sys

def input():
	return sys.stdin.readline()[:-1]
for _ in range(int(input().strip())):
	(n, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	common_values = [0 for _ in range(2 * k + 2)]
	for i in range(n // 2):
		(a, b) = (nums[i], nums[n - 1 - i])
		common_values[a + b - max(a, b) + 1] -= 1
		common_values[a + b] -= 1
		common_values[a + b + 1] += 1
		common_values[a + b - min(a, b) + k + 1] += 1
	common_values[1] = n
	minimum = n
	for i in range(2, 2 * k + 1):
		common_values[i] += common_values[i - 1]
		minimum = min(minimum, common_values[i])
	print(minimum)


for i in range(int(input())):
	a = int(input())
	l = []
	s = 0
	if a % 4 != 0:
		print('NO')
		continue
	for j in range(1, a // 2 + 1):
		s += 2 * j
		l.append(2 * j)
	s1 = 0
	for j in range(1, a // 2):
		l.append(2 * j - 1)
		s1 += 2 * j - 1
	l.append(abs(s1 - s))
	print('YES')
	for j in range(len(l)):
		if j == len(l) - 1:
			print(l[j])
		else:
			print(l[j], end=' ')


T = int(input())
i = 0
while i < T:
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		a = [4 * i + 4 for i in range(n // 4)] + [4 * i + 2 + 2 * n for i in range(n // 4)] + [4 * i + 1 for i in range(n // 4)] + [4 * i + 5 + 2 * n for i in range(n // 4)]
		print('YES')
		print(*a)
	i += 1


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		x = []
		for j in range(2, n + 1, 2):
			x.append(j)
		for j in range(1, n + 1, 2):
			x.append(j)
		x[-1] = x[-1] + n // 2
		for j in x:
			print(j, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		lista = []
		x = 2
		for j in range(n // 2 // 2):
			lista += [x]
			lista += [x + 2]
			x += 8
		x = -3
		for k in range(n // 2):
			x += 4
			lista += [x]
		print('YES')
		for k in lista:
			print(k, end=' ')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = int(input())
	if a % 4 == 0:
		print('YES')
		fh = [int(i) for i in range(1, a + 1) if i % 2 == 0]
		sh = [int(i) for i in range(a) if i % 2 != 0]
		sh[-1] = sh[-1] + int(a / 2)
		print(*fh, *sh)
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = [6 * i + 2 for i in range(n // 4)] + [6 * i + 4 for i in range(n // 4)] + [6 * i + 1 for i in range(n // 4)] + [6 * i + 5 for i in range(n // 4)]
		print(*ans)


n = int(input())
for i in range(n):
	x = int(input())
	if x / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		l1 = []
		for i in range(0, x + 1, 2):
			l.append(str(i))
			l1.append(i)
		l.remove('0')
		l1.remove(0)
		for j in range(1, x - 1, 2):
			l.append(str(j))
			l1.append(j)
		l.append(str(sum(l1[:int(x / 2)]) - sum(l1[int(x / 2):])))
		print(' '.join(l))


t = int(input())
for i in range(t):
	n = int(input())
	arr = [0] * n
	p1 = n // 2
	if (n - p1) % 2 != 0:
		print('NO')
	else:
		now = 2
		for i in range(p1):
			arr[i] = now
			now += 2
		summ = sum(arr)
		now = 1
		summ2 = 0
		for i in range(p1 - 1):
			arr[i + p1] = now
			summ2 += now
			now += 2
		arr[-1] = summ - summ2
		print('YES')
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		even = [(i + 1) * 2 for i in range(n // 2)]
		odd = [2 * i + 1 for i in range(n // 2 - 1)]
		odd.append(sum(even) - sum(odd))
		print('YES')
		print(' '.join(map(str, even + odd)))


import sys
import collections
import threading

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	n2 = n // 2
	mapa = [0] * (2 * k + 2)
	d = [0] * (2 * k + 2)
	for i in range(n // 2):
		(b, c) = (a[i], a[n - i - 1])
		if b > c:
			(b, c) = (c, b)
		mapa[b + 1] += 1
		mapa[c + k + 1] -= 1
		d[b + c] += 1
	for i in range(1, len(mapa)):
		mapa[i] += mapa[i - 1]
	ans = n
	for i in range(2, len(mapa)):
		ans = min(ans, n - mapa[i] - d[i])
	print(ans)
input = sys.stdin.readline
tnum = int(input())
for _ in range(tnum):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	a = 2
	b = 1
	suml = a
	sumr = b
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(a, end=' ')
		for j in range(n // 2 - 1):
			a += 2
			print(a, end=' ')
			suml += a
		print(b, end=' ')
		for j in range(n // 2 - 2):
			b += 2
			print(b, end=' ')
			sumr += b
		print(suml - sumr)


z = input
from math import *
n1 = int(z())
for _ in range(n1):
	n = int(z())
	lx = []
	ly = []
	s1 = 0
	s2 = 0
	for i in range(1, n + 1):
		if i % 2 == 0:
			lx.append(i)
			s1 += i
		else:
			ly.append(i)
	p = sum(ly)
	t = abs(p - s1)
	ly[-1] = ly[-1] + t
	s2 = sum(ly)
	if s1 == s2 and ly[-1] % 2 != 0:
		print('YES')
		print(*lx + ly)
	else:
		print('NO')


T = int(input())
for case in range(T):
	n = int(input())
	impossible = False
	a = []
	half_sum = 0
	if n // 2 % 2 == 0:
		for i in range(0, n // 2):
			candidate = 2 * (i + 1)
			a.append(2 * (i + 1))
			half_sum += candidate
		for i in range(0, n // 2 - 1):
			candidate = a[i] - 1
			a.append(a[i] - 1)
			half_sum -= candidate
		a.append(half_sum)
	else:
		impossible = True
	if impossible:
		print('NO')
		continue
	print('YES')
	for i in range(len(a)):
		print(a[i], end=' ')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lis = list(map(int, input().split()))
	ans = [0] * (2 * k + 2)
	aa = []
	for i in range(n // 2):
		mm = min(lis[i], lis[n - i - 1])
		mx = max(lis[i], lis[n - i - 1])
		aa.append([mm, mx])
		ans[mm + 1] += 1
		ans[mx + k + 1] -= 1
	for i in range(1, 2 * k + 2):
		ans[i] += ans[i - 1]
	for i in range(2, 2 * k + 2):
		ans[i] += n - ans[i] * 2
	for i in range(n // 2):
		ans[aa[i][0] + aa[i][1]] -= 1
	print(min(ans[2:]))


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = int(math.log2(n))
	if n // 2 & 1 == 0:
		print('YES')
		a = 2
		for i in range(n // 2):
			print(a, end=' ')
			a += 2
		a = 1
		for i in range(n // 2 + 1):
			if i == n // 4:
				a += 2
				continue
			print(a, end=' ')
			a += 2
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0 or n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(1, n // 2 + 1):
			l.append(2 * i)
		k = sum(l)
		for i in range(1, n // 2):
			l.append(2 * i - 1)
		l.append(k - sum(l[n // 2:]))
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		s1 = [str(2 * i + 1) for i in range(n // 2 - 1)] + [str(3 * n // 2 - 1)]
		s2 = [str(2 * j) for j in range(1, n // 2 + 1)]
		print(' '.join(s2 + s1))
	else:
		print('NO')


t = int(input())
ns = [int(input()) for i in range(t)]
for n in ns:
	if n / 2 % 2 != 0:
		print('NO')
		continue
	arr1 = [2 * even for even in range(1, n // 2 + 1)]
	arr2 = [it - 1 for it in arr1]
	arr2[-1] = arr1[n // 2 - 1] + (n // 2 - 1)
	print('YES')
	print(*arr1 + arr2, sep=' ')


for _ in range(int(input())):
	k = int(input()) // 2
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		res = [2 * i for i in range(1, k + 1)] + [2 * i - 1 for i in range(1, k)] + [3 * k - 1]
		print(' '.join(map(str, res)))


for x1 in range(int(input())):
	k = int(input())
	if k // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		z = []
		z1 = []
		for x in range(0, k // 2, 1):
			if x != k // 2 - 1:
				z.append((x + 1) * 2)
				z1.append((x + 1) * 2 - 1)
			else:
				z.append((x + 1) * 2)
				k = sum(z)
				k1 = sum(z1)
				z1.append(abs(k1 - k))
		print(*z, *z1)


t = int(input())
pole_neparne = [1]
pole_neparne_index = 1
pole_parne = [2]
pole_parne_index = 1
for x in range(t):
	n = int(input())
	if n % 4 != 0 or n == 0:
		print('NO')
	else:
		pocet = int(n / 2)
		if pole_neparne_index < pocet + 1:
			while pole_neparne_index <= pocet:
				pole_neparne.append(pole_neparne[-1] + 2)
				pole_neparne_index += 1
		if pole_parne_index < pocet:
			while pole_parne_index <= pocet:
				pole_parne.append(pole_parne[-1] + 2)
				pole_parne_index += 1
		print('YES')
		print(*pole_parne[0:pocet], sep=' ', end=' ')
		print(*pole_neparne[0:int(pocet / 2)], sep=' ', end=' ')
		print(*pole_neparne[int(pocet / 2 + 1):pocet + 1], sep=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	inc = -1
	evens = list(range(2, n + 1, 2))
	odds = [number - 1 for number in evens[:-1]]
	odds.append(sum(evens) - sum(odds))
	print(' '.join(map(str, evens + odds)))


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())
for case in range(itg()):
	n = itg()
	if n % 4 != 0:
		print('NO')
		continue
	n >>= 1
	a = list(range(2, 2 * (n + 1), 2))
	a.extend(list(map(lambda x: x - 1, a)))
	a[-1] += n
	print('YES')
	print(*a)


def solve(n):
	size_half = n // 2
	if size_half % 2 != 0:
		return None
	even_half = [2 * i for i in range(1, size_half + 1)]
	odd_half = [2 * i + 1 for i in range(size_half)]
	diff = sum(even_half) - sum(odd_half)
	odd_half[size_half - 1] += diff
	result = even_half + odd_half
	return result
for i in range(int(input())):
	n = int(input())
	result = solve(n)
	if result is None or len(result) == 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, result)))


for t in range(int(input())):
	n = int(input())
	a1 = []
	a2 = []
	ans = ''
	if n // 2 & 1:
		ans = 'NO'
	else:
		ans = 'YES'
		x = 4
		for i in range(n // 2 // 2):
			a1.append(x)
			a2.append(x - 1)
			x = x + 4
			a1.append(x)
			a2.append(x + 1)
			x = x + 4
	ans_f = []
	for i in a1:
		ans_f.append(i)
	for i in a2:
		ans_f.append(i)
	if ans == 'NO':
		print(ans)
	else:
		print(ans)
		for i in ans_f:
			print(i, end=' ')
		print()


from itertools import accumulate

def solve(n, k, arr):
	count = [0] * (2 * k + 2)
	for i in range(n // 2):
		(a, b) = (arr[i], arr[n - i - 1])
		if a > b:
			(a, b) = (b, a)
		count[a + 1] += 1
		count[b + k + 1] -= 1
		count[a + b] += 1
		count[a + b + 1] -= 1
	return n - max(accumulate(count))
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(solve(n, k, arr))
assert solve(4, 2, [1, 2, 1, 2]) == 0
assert solve(4, 3, [1, 2, 2, 1]) == 1
assert solve(8, 7, [6, 1, 1, 7, 6, 3, 4, 6]) == 4
assert solve(6, 6, [5, 2, 6, 1, 3, 4]) == 2


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = 0
		a = []
		for i in range(n // 2):
			print(i + k + 2, end=' ')
			a.append(i + k + 2)
			k += 1
		for i in range(len(a) // 2):
			print(a[i] - 1, end=' ')
		for i in range(len(a) // 2, len(a)):
			print(a[i] + 1, end=' ')
		print(' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		li = [x * 2 for x in range(1, n // 2 + 1)]
		li2 = [x - 1 for x in li]
		li2[-1] += n // 2
		li3 = li + li2
		print(' '.join(map(str, li3)))
	else:
		print('NO')


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, k) = iis()
	a = liis()
	counter = {}
	poss = []
	for i in range(n // 2):
		ini = a[i]
		fim = a[n - i - 1]
		if ini <= k and fim <= k:
			if ini + fim not in counter:
				counter[ini + fim] = 0
			counter[ini + fim] += 1
	add = [0 for i in range(2 * k + 2)]
	rem = [0 for i in range(2 * k + 2)]
	alt = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		ini = a[i]
		fim = a[n - i - 1]
		mini = 1 + min(ini, fim)
		maxi = k + max(ini, fim)
		alt[ini + fim] += 1
		add[mini] += 1
		rem[maxi + 1] += 1
	count = 0
	for i in range(2, len(add) - 1):
		count += add[i] - rem[i]
		two = (n // 2 - count) * 2
		poss.append(count - alt[i] + two)
	print(min(poss))


import sys
import math
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		half = n // 2
		ans = []
		s1 = 0
		for i in range(2, 2 + half * 2, 2):
			ans.append(str(i))
			s1 += i
		s2 = 0
		for i in range(1, half * 2 - 1, 2):
			ans.append(str(i))
			s2 += i
		ans.append(str(s1 - s2))
		assert (s1 - s2) % 2 == 1
		print(' '.join(ans))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		set1 = set()
		set2 = set()
		print('YES')
		for j in range(2, n + 1, 2):
			set1.add(j)
			if j != n:
				set2.add(j - 1)
			else:
				set2.add(j + n // 2 - 1)
			print(j, end=' ')
		for j in set2:
			print(j, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		res = []
		odd = list(range(1, n, 2))
		even = list(range(2, n + 1, 2))
		odd[-1] += n // 2
		res = even + odd
		for item in res:
			print(item, end=' ')
		print('')


t = int(input())
for q in range(t):
	n = int(input())
	a = 2 * n - 1
	ans = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(a - n // 2, a + n // 2):
			if i % 2 == 0:
				ans.append(i)
		for i in range(a - n // 2, a + n // 2 + 1):
			if i % 2 != 0 and i != a:
				ans.append(i)
		for i in ans:
			print(i, end=' ')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		num = int(input())
		if (num // 2 - 1) % 2:
			yield 'YES'
			firsthalf = list(map(lambda x: x * 2, range(1, num // 2 + 1)))
			secondhalf = list(map(lambda x: x * 2 - 1, range(1, num // 2)))
			ans = firsthalf + secondhalf + [num * 3 // 2 - 1]
			yield ' '.join((str(x) for x in ans))
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


from sys import stdin, stdout
from math import 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

def solve():
	n = inp()
	a = n // 2
	if a & 1:
		pr('NO')
	else:
		val = 10 ** 8
		a = [val]
		eve = val
		for i in range(1, n // 2):
			eve += 2 * i
			a.append(2 * i)
		odd = 0
		for i in range(1, n // 2):
			odd += 2 * i - 1
			a.append(2 * i - 1)
		a.append(eve - odd)
		print('YES')
		print(*a)
for _ in range(inp()):
	solve()


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		a1 = [i for i in range(2, n + 1, 2)]
		s1 = sum(a1)
		a2 = [i for i in range(1, n - 1, 2)]
		s2 = sum(a2)
		a = a1 + a2 + [s1 - s2]
		print(*a)


t = int(input())
b = []
for i in range(t):
	summ = 0
	sum1 = 0
	a = ''
	n = int(input())
	if n / 2 % 2 != 0:
		b.append('NO')
	else:
		b.append('YES')
		for j in range(int(n / 2)):
			a += str((j + 1) * 2) + ' '
			summ = summ + (j + 1) * 2
		for j in range(int(n / 2) - 1):
			a += str((j + 1) * 2 - 1) + ' '
			sum1 = sum1 + (j + 1) * 2 - 1
		a += str(summ - sum1)
		b.append(a)
for i in range(len(b)):
	print(b[i])


t = int(input())
for t_itr in range(0, t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		e = 2
		o = 1
		eve = '2'
		odd = '1'
		for i in range(1, n // 2):
			eve += ' ' + str(int(e) + 2)
			e += 2
			if i < n // 2 - 1:
				odd += ' ' + str(int(e) - 1)
			else:
				odd += ' ' + str(int(e) + (n // 2 - 1))
		print(''.join(eve) + ' ' + ''.join(odd))


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		l = [2 * i for i in range(1, n // 2 + 1)]
		l1 = [2 * i - 1 for i in range(1, n // 2)]
		l = l + l1 + [sum(l) - sum(l1)]
		print(*l)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		evn = [e for e in range(2, n + 1, 2)]
		unevn = []
		strt = 1
		for j in range(len(evn) - 1):
			unevn.append(strt)
			strt += 2
		unevn.append(sum(evn) - sum(unevn))
		out = evn + unevn
		for p in out:
			print(p, end=' ')
		print()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	count = [0 for i in range(2 * k + 1)]
	pref = [0 for i in range(2 * k + 2)]
	for i in range(len(arr) // 2):
		summ = arr[i] + arr[-(i + 1)]
		count[summ] += 1
		minval = 1 + min(arr[i], arr[-(i + 1)])
		maxval = k + max(arr[i], arr[-(i + 1)])
		pref[minval] += 1
		pref[maxval + 1] -= 1
	for i in range(1, len(pref)):
		pref[i] += pref[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		changes = pref[i] - count[i] + (n // 2 - pref[i]) * 2
		ans = min(ans, changes)
	print(ans)


for tc in range(0, int(input())):
	n = int(input())
	if n // 2 % 2 != 0 or n % 2 != 0:
		print('NO')
	else:
		left_half = [x for x in range(2, n + 1, 2)]
		right_half = [l - 1 for l in left_half[0:-1]]
		right_half.append(sum(left_half) - sum(right_half))
		full = [*left_half, *right_half]
		print('YES')
		print(' '.join(map(str, full)))


for _ in range(int(input())):
	n = int(input())
	s = n * (n + 1) // 2
	if s % 2:
		print('NO')
	else:
		print('YES')
		a = [2] * (n // 2) + [1] * (n // 2)
		(s1, s2) = (0, 0)
		for i in range(n):
			if a[i] % 2 == 0:
				a[i] *= i + 1
				s1 += a[i]
			elif i < n - 1:
				a[i] = 2 * (i - n // 2) + 1
				s2 += a[i]
			else:
				a[i] = s1 - s2
		print(*a)


def solve(x):
	ans = []
	if x % 4 != 0:
		print('NO')
	else:
		print('YES')
		c = 0
		y = int(x / 4)
		for i in range(2, x + 1, 2):
			ans.append(i)
			c += 1
		for j in range(1, 2 * x, 2):
			if c != x - 1:
				ans.append(j)
				c += 1
			elif c == x - 1:
				for i in range(y):
					j += 2
				ans.append(j)
				break
		print(*ans)
n = int(input())
for i in range(n):
	x = int(input())
	solve(x)


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	k = n // 2
	if k % 2 == 0:
		print('YES')
		a = 2
		ans = []
		for i in range(k):
			ans.append(a)
			a += 4
		b = []
		for i in range(k):
			if i % 2 == 0:
				b.append(ans[i] - 1)
			else:
				b.append(ans[i] + 1)
		ans += b
		print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ct = n // 2
		k = 0
		even = 2
		while ct > 0:
			print(even, end=' ')
			ct -= 1
			even += 4
		ct = n // 2
		k = 0
		odd = 1
		while ct > 0:
			print(odd, end=' ')
			if k % 2 == 0:
				odd += 6
			else:
				odd += 2
			k += 1
			ct -= 1
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l1 = [j for j in range(2, n + 1, 2)]
		l2 = [k for k in range(1, n - 1, 2)]
		a = sum(l1) - sum(l2)
		l2.append(a)
		l = l1 + l2
		for z in l:
			print(z, end=' ')
		print('')


from sys import stdin, stdout
import math, collections
mod = 10 ** 9 + 7
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	arr = list(map(int, stdin.readline().split()))
	a = [0] * (2 * k)
	mi = []
	ma = []
	for i in range(n // 2):
		a[arr[i] + arr[~i] - 1] += 1
		mi.append(min(arr[i], arr[~i]) + 1)
		ma.append(max(arr[i], arr[~i]) + k)
	mi.sort()
	ma.sort()
	m1 = 0
	m2 = 0
	ans = n
	for i in range(2 * k):
		while m1 < n // 2 and mi[m1] <= i + 1:
			m1 += 1
		while m2 < n // 2 and ma[m2] < i + 1:
			m2 += 1
		ans = min(ans, m1 + 2 * (n // 2 - m1) + m2 - a[i])
	stdout.write(str(ans) + '\n')


def generate_even(n):
	even = []
	for i in range(2, n + 1, 2):
		even.append(i)
	return even

def generate_odd(n):
	odd = []
	for i in range(1, n, 2):
		odd.append(i)
	return odd
test = int(input())
for cases in range(test):
	n = int(input())
	flag = 0
	if n == 2:
		print('NO')
	else:
		even = generate_even(n)
		evesum = sum(even)
		odd = generate_odd(n)
		oddsum = sum(odd)
		diff = evesum - oddsum
		if diff % 2 == 0:
			flag = 1
			odd[-1] += diff
		if flag == 1:
			print('YES')
			print(*even, *odd)
		elif flag == 0:
			print('NO')


from math import ceil, floor
for _ in range(int(input())):
	n = int(input())
	if ceil((n + 2) / 4) == floor((n + 2) / 4):
		print('NO')
	else:
		print('YES')
		a = n // 2
		for i in range(1, a + 1):
			print(4 * i, end=' ')
		if a % 2:
			for i in range(1, a - 1):
				if i % 2:
					print(4 * i - 1, end=' ')
				else:
					print(4 * i + 1, end=' ')
			print(4 * (a - 2) + 2, 4 * a - 1)
		else:
			for i in range(1, a + 1):
				if i % 2:
					print(4 * i - 1, end=' ')
				else:
					print(4 * i + 1, end=' ')
			print()


from sys import stdin, stdout
from bisect import bisect_left
from bisect import bisect_right
for _ in range(int(input())):
	(n, k) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	sums = [0] * (2 * k + 1)
	mini = []
	maxi = []
	for i in range(n // 2):
		sumi = a[i] + a[n - i - 1]
		sums[sumi] += 1
		mini.append(min(a[i], a[n - i - 1]))
		maxi.append(max(a[i], a[n - i - 1]))
	mini.sort()
	maxi.sort()
	minti = 100000000000000
	for x in range(2, 2 * k + 1):
		mnpos = n // 2 - bisect_left(mini, x)
		mxpos = bisect_left(maxi, x - k)
		c2 = mnpos + mxpos
		c1 = n // 2 - sums[x] - c2
		minti = min(minti, c1 + c2 * 2)
	print(minti)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			if i <= n // 2:
				print(2 * i, end=' ')
			elif i <= 3 * n // 4:
				print(2 * (i - n // 2) - 1, end=' ')
			else:
				print(2 * (i - n // 2) + 1, end=' ')
		print()


import math
import sys
msg = sys.stdin.read()
l = list(map(int, msg.split()))
l = l[1:]

def array(n):
	k = int(n / 2)
	even = [2 * i + 2 for i in range(k)]
	odd = [2 * i + 1 for i in range(k)]
	odd[-1] += k
	l = even + odd
	return l
for i in l:
	k = i / 2
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, array(i))))


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		arr = []
		ev = 0
		for i in range(n // 2):
			arr.append((i + 1) * 2)
			ev += (i + 1) * 2
		od = 0
		c = -1
		for j in range(n // 2, n - 1):
			arr.append(c + 2)
			c += 2
			od += c
		arr.append(ev - od)
		print('YES')
		print(*arr)


from bisect import bisect_left as lower_bound, bisect_right as upper_bound
from sys import stdin, stdout
from collections import defaultdict

def solve(arr, n):
	pass

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4 != 0:
			print('NO')
			continue
		ret = [-1 for _ in range(n)]
		for i in range(n // 2):
			ret[i] = (i + 1) * 2
		sign = 0
		for i in range(n // 2, n):
			ret[i] = ret[i - n // 2]
			diff = i - n // 2
			if diff < n // 4:
				ret[i] -= 1
			else:
				ret[i] += 1
		print('YES')
		print(' '.join(list(map(str, ret))))
main()


from math import log2, ceil, floor
for _ in range(int(input())):
	n = int(input())
	j = n // 2
	if j % 2 == 0:
		print('YES')
		t = n // 2
		l = []
		p = 2
		for x in range(t):
			l.append(p)
			p += 2
		p = 1
		j = sum(l)
		for x in range(t - 1):
			l.append(p)
			j -= p
			p += 2
		l.append(j)
		print(*l)
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	k = n // 2
	if k % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(1, k + 1):
			print(i * 2, end=' ')
		for i in range(1, k):
			print(i * 2 - 1, end=' ')
		print(3 * k - 1)


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


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = []
		an = 0
		for i in range(n // 2):
			q = (i + 1) * 2
			a.append(q)
			an += q
		ans = 0
		for i in range(n // 2, n - 1):
			p = 2 * (i - n // 2 + 1) - 1
			a.append(p)
			ans += p
		a.append(an - ans)
		print('YES')
		for i in a:
			print(i, end=' ')
		print(end='\n')
t = int(input())
for _ in range(1, t + 1):
	solve()


def calculate(num):
	if num % 4:
		print('NO')
		return None
	print('YES')
	num = int(num / 2)
	even_list = []
	odd_list = []
	for i in range(1, num + 1):
		even_list.append(str(i * 2))
	for i in range(1, num):
		odd_list.append(str(i * 2 - 1))
	odd_list.append(str(3 * num - 1))
	even_list = even_list + odd_list
	print(' '.join(even_list))
t = int(input())
for i in range(t):
	num = int(input())
	calculate(num)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	if n / 2 % 2 == 0:
		print('YES')
		arr = []
		k = 2
		y = n
		while k < n + 1:
			a = k
			arr.append(a)
			k = k + 2
		for i in range(n // 2 - 1):
			a = arr[i] - 1
			arr.append(a)
		final = arr[n // 2 - 1] + n // 2 - 1
		arr.append(final)
		print(*arr, sep=' ')
	else:
		print('NO')


def array(n):
	if n % 4:
		print('NO')
		return
	print('YES')
	print(*[2 * i for i in range(1, n // 2 + 1)] + [2 * i - 1 for i in range(1, n // 4 + 1)] + [2 * i + 1 for i in range(n // 4 + 1, n // 2 + 1)])
t = int(input())
for i in range(t):
	n = int(input())
	array(n)


for _ in range(int(input())):
	n = int(input())
	b = []
	b.append(1)
	if n % 4 != 0:
		print('NO')
	else:
		k = 1
		for i in range(n // 2 - 1):
			x = (4 * k + 2) // 2
			b.append(x)
			k += 1
		b[len(b) - 1] += 2 * k // 2
		print('YES')
		k = 1
		for i in range(n // 2):
			print(2 * k, end=' ')
			k += 1
		print(*b)


t = int(input())
for i in range(t):
	n = int(input())
	even = [x for x in range(2, n + 1, 2)]
	odd = [x for x in range(1, n - 1, 2)]
	se = sum(even)
	so = sum(odd)
	if (se - so) % 2 == 0:
		print('NO')
	elif se - so in odd:
		print('NO')
	else:
		print('YES')
		print(' '.join(list(map(str, even))), end=' ')
		print(' '.join(list(map(str, odd))), end=' ')
		print(se - so)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n // 2 % 2 != 0:
			print('NO')
			continue
		else:
			a = [0] * n
			x = 2
			for i in range(0, n // 2):
				a[i] = x
				x += 2
			y = 1
			for i in range(n // 2, n - 1):
				a[i] = y
				y += 2
			a[n - 1] = a[n - 2] + n // 2 + 2
			print('YES')
			for i in a:
				print(i, end=' ')
			print()
			continue
main()


t = int(input())
l = [] * t
for k in range(t):
	l.append(int(input()))
for n in l:
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		c = n // 2
		a = [] * c
		b = [] * c
		for i in range(2, n, 2):
			a.append(i)
			b.append(i - 1)
		a.append(n)
		b.append(n + n // 2 - 1)
		a.extend(b)
		for j in a:
			print(j, end=' ')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n % 4 != 0:
		stdout.write('NO\n')
		continue
	a = []
	v = 2
	b = []
	stdout.write('YES\n')
	for i in range(n // 2):
		a += [v]
		v += 4
	for i in range(n // 2):
		a += [a[i] + [1, -1][i & 1]]
	print(*a)


for case in range(int(input())):
	n = int(input())
	ans = []
	p1sum = 0
	p2sum = 0
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1):
			if i % 2 == 0:
				ans.append(i)
				p1sum += i
		for i in range(1, n // 2):
			if (i * 2 - 1) % 2 != 0:
				ans.append(i * 2 - 1)
				p2sum += i * 2 - 1
		ans.append(p1sum - p2sum)
		print(*ans)


test = int(input())
for t in range(test):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sume = 0
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
			sume += 2 * i
		sum0 = 0
		for i in range(1, n - 2, 2):
			print(i, end=' ')
			sum0 += i
		print(sume - sum0)


def not_valid_number(number: int) -> bool:
	return not number / 2 % 2 == 0

def build_first_half_of_array() -> dict:
	first_half: list = [2]
	sum_of_first_half = 2
	for i in range(int(test_case / 2) - 1):
		element = first_half[-1] + 2
		first_half.append(element)
		sum_of_first_half += element
	return dict(array=first_half, sum=sum_of_first_half)

def build_second_half_of_array(sum_of_even_list: int) -> list:
	second_half: list = [1]
	sum_of_second_half = 1
	for i in range(int(test_case / 2 - 2)):
		element = second_half[-1] + 2
		second_half.append(element)
		sum_of_second_half += element
	second_half.append(sum_of_even_list - sum_of_second_half)
	return second_half

def merge_arrays(first_array, second_array) -> list:
	return first_array + second_array

def array_to_space_separated_string(array: list) -> str:
	return ' '.join(map(str, array))

def valid_number_generator() -> str:
	even_number_dict = build_first_half_of_array()
	odd_number_list = build_second_half_of_array(even_number_dict['sum'])
	number_array = merge_arrays(even_number_dict['array'], odd_number_list)
	return array_to_space_separated_string(number_array)

def print_output(array: list):
	for i in array:
		print(i)
array_length: int = int(input())
output: list = []
while array_length > 0:
	test_case = int(input())
	if not_valid_number(test_case):
		output.append('NO')
	else:
		string_of_number = valid_number_generator()
		output.append('YES')
		output.append(string_of_number)
	array_length -= 1
print_output(output)


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())

class LazySegmentTree:

	def __init__(self, data, default=0, func=max):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self._lazy = [0] * (2 * _size)
		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 __len__(self):
		return self._len

	def _push(self, idx):
		(q, self._lazy[idx]) = (self._lazy[idx], 0)
		self._lazy[2 * idx] += q
		self._lazy[2 * idx + 1] += q
		self.data[2 * idx] += q
		self.data[2 * idx + 1] += q

	def _update(self, idx):
		for i in reversed(range(1, idx.bit_length())):
			self._push(idx >> i)

	def _build(self, idx):
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1]) + self._lazy[idx]
			idx >>= 1

	def add(self, start, stop, value):
		start = start_copy = start + self._size
		stop = stop_copy = stop + self._size
		while start < stop:
			if start & 1:
				self._lazy[start] += value
				self.data[start] += value
				start += 1
			if stop & 1:
				stop -= 1
				self._lazy[stop] += value
				self.data[stop] += value
			start >>= 1
			stop >>= 1
		self._build(start_copy)
		self._build(stop_copy - 1)

	def query(self, start, stop, default=0):
		start += self._size
		stop += self._size
		self._update(start)
		self._update(stop - 1)
		res = 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 'LazySegmentTree({0})'.format(self.data)
INF = int(10000000.0)
for case in range(itg()):
	(n, k) = mpint()
	arr = tuple(mpint())
	tree = LazySegmentTree([n] * (2 * k + 1), INF, min)
	for i in range(n >> 1):
		(a, b) = (arr[i], arr[-i - 1])
		mn = min(a, b) + 1
		mx = max(a, b) + k
		tree.add(mn, mx + 1, -1)
		tree.add(a + b, a + b + 1, -1)
	print(tree.query(0, len(tree), INF))


def run(n):
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		soma1 = (2 + n) * (n / 2) / 2
		n_e_soma_parcial = n / 2 - 1
		u_el_soma_parcial = 1 + 2 * n_e_soma_parcial - 2
		soma2 = (1 + u_el_soma_parcial) * n_e_soma_parcial / 2
		el_adic = soma1 - soma2
		for i in range(int(n / 2)):
			print(str((i + 1) * 2), end=' ')
		for i in range(int(n / 2 - 1)):
			print(str(1 + 2 * i), end=' ')
		print(str(int(el_adic)))
i = int(input())
for _ in range(i):
	n = int(input())
	run(n)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		for i in range(2, n + 1, 2):
			sum += i
			print(i, end=' ')
		c = 1
		sum2 = 0
		for i in range(n // 2 - 1):
			print(c, end=' ')
			sum2 += c
			c += 2
		print(sum - sum2)


def convert(n):
	s = [str(d) for d in n]
	res = ' '.join(s)
	return res
t = int(input())
i = 0
v = []
for i in range(t):
	n = int(input())
	v.append(n)
for d in v:
	k = []
	g = 0
	p = 0
	l = 2
	m = 1
	for s in range(d + 1):
		if d == 2 + 4 * g:
			k.clear()
			break
		elif s < d // 2:
			k.append(l)
			p += l
			l = l + 2
		elif s > d // 2 and s < d:
			k.append(m)
			p -= m
			m = m + 2
		elif s == d:
			k.append(p)
		g += 1
	if k == []:
		print('No')
	else:
		print('Yes')
		print(convert(k))


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def yo():
	for _ in range(int(input().strip())):
		(n, k) = map(int, input().split())
		nums = list(map(int, input().split()))
		common_values = [0 for _ in range(2 * k + 2)]
		for i in range(n // 2):
			(a, b) = (nums[i], nums[n - 1 - i])
			common_values[a + b - max(a, b) + 1] -= 1
			common_values[a + b] -= 1
			common_values[a + b + 1] += 1
			common_values[a + b - min(a, b) + k + 1] += 1
		common_values[1] = n
		minimum = n
		for i in range(2, 2 * k + 1):
			common_values[i] += common_values[i - 1]
			minimum = min(minimum, common_values[i])
		print(minimum)
yo()


t = int(input())
while t:
	(n, k) = map(int, input().split())
	li = list(map(int, input().split()))
	one_counts = [0] * (2 * k + 5)
	pairs_array = []
	for i in range(len(li) // 2):
		pairs_array.append([min(li[i], li[n - i - 1]), max(li[i], li[n - i - 1])])
	zero_counts = {}
	for pair in pairs_array:
		lower_bound = pair[0] + 1
		upper_bound = pair[1] + k
		if not zero_counts.get(pair[0] + pair[1]):
			zero_counts[pair[0] + pair[1]] = 1
		else:
			zero_counts[pair[0] + pair[1]] += 1
		one_counts[lower_bound] += 1
		one_counts[upper_bound + 1] -= 1
	for i in range(1, len(one_counts)):
		one_counts[i] = one_counts[i] + one_counts[i - 1]
	min_nums = n
	for i in range(2, 2 * k + 1):
		total_sum = i
		zero_changes = 0
		if zero_counts.get(i):
			zero_changes = zero_counts[i]
		one_changes = one_counts[i] - zero_changes
		two_changes = n // 2 - one_changes - zero_changes
		min_nums = min(one_changes + two_changes * 2, min_nums)
	print(min_nums)
	t -= 1


def balanced_array(n):
	if int(n / 2) % 2 != 0:
		return []
	else:
		arr = []
		even = 2
		odd = 1
		for _ in range(int(n / 2)):
			arr.append(even)
			even += 2
		for _ in range(int(n / 2) - 1):
			arr.append(odd)
			odd += 2
		arr.append(even - 2 + int(n / 2) - 1)
		return arr
t = int(input())
for t_itr in range(t):
	n = int(input())
	result = balanced_array(n)
	if len(result) == 0:
		print('NO')
	else:
		print('YES')
		print(*result)


t = int(input())
while t > 0:
	n1 = int(input())
	mid = n1 // 2
	(n, m, sum, sum1, z, count, F) = ([], [], 0, 0, 1, 0, 0)
	for i in range(1, mid + 1):
		if i % 2 == 0:
			n.append(str(i))
			sum += int(i)
		else:
			m.append(str(i))
			sum1 += int(i)
	for j in range(mid + 1, n1 + 1):
		if j % 2 == 1:
			m.append(str(j))
			sum1 += int(j)
		else:
			n.append(str(j))
			sum += int(j)
	while 1:
		if sum == sum1:
			break
		elif sum < sum1:
			F = 1
			break
		else:
			sum1 += 2
			count += 2
	if F == 1:
		print('NO')
	else:
		m[len(m) - 1] = str(int(m[len(m) - 1]) + count)
		print('YES')
		print(' '.join(n + m))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		print(' '.join([str(i) for i in range(2, n + 1, 2)]), ' '.join([str(i) for i in range(1, n - 2, 2)]), int(n / 2 - 1 + n))


n = int(input())
for i in range(n):
	s = int(input())
	if s % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = 0
		m = 0
		g = 0
		while k < s // 2:
			m = m + 2
			print(m, end=' ')
			k = k + 1
			g = g + m
		j = 0
		d = -1
		o = 0
		while j < s // 2 - 1:
			d = d + 2
			print(d, end=' ')
			j = j + 1
			o = o + d
		f = g - o
		print(f)


try:
	t = int(input())
	for test in range(t):
		y = []
		n = int(input())
		if n / 2 % 2 == 1:
			print('NO')
		if n / 2 % 2 == 0:
			print('YES')
			for j in range(int(n / 2)):
				y.append(2 * (j + 1))
			for j in range(int(n / 2) - 1):
				y.append(2 * j + 1)
			y.append(int(3 * n / 2) - 1)
			print(*y)
except:
	pass


n = int(input())
for i in range(n):
	(s, s2) = (0, 0)
	p = 0
	k = 1
	arr = []
	m = int(input())
	m1 = m // 2
	for j in range(2, m + 1, 2):
		s += j
		arr.append(j)
	while p < m1 - 1:
		arr.append(k)
		s2 += k
		k += 2
		p += 1
	last = s - s2
	arr.append(last)
	so = s2 + last
	if last % 2 != 0 and s == so:
		print('YES')
		print(*arr, sep=' ')
	else:
		print('NO')


for i in range(0, int(input())):
	a = int(input())
	if a % 4 == 0:
		print('YES')
		q = a // 2
		ss = 0
		m = 0
		j = 2
		while m != q:
			ss = ss + j
			print(j, end=' ')
			j = j + 2
			m = m + 1
		s = 0
		m = 0
		j = 1
		while m != q - 1:
			s = s + j
			print(j, end=' ')
			j = j + 2
			m = m + 1
		print(ss - s)
	else:
		print('NO')


def solve(n):
	tab = list()
	half = n // 2
	if half % 2 == 0:
		cpt = 2
		for x in range(half):
			tab.append(cpt)
			cpt += 2
		cpt = 2
		for x in range(half - 1):
			tab.append(cpt - 1)
			cpt += 2
		tab.append(cpt + half - 1)
	return tab
T = int(input())
for line in range(T):
	n = int(input())
	tab = solve(n)
	if tab:
		print('YES')
		print(' '.join((str(x) for x in tab)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO', end='\n')
	else:
		print('Yes', end='\n')
		j = 2
		for i in range(n // 2):
			print(j, end=' ')
			j = j + 2
		val = j - 2
		j = 1
		for i in range(1, n // 2):
			print(j, end=' ')
			j = j + 2
		print(val + n // 2 - 1, end='\n')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		c = []
		d = []
		k = 0
		m = -1
		a = 0
		b = 0
		while 1:
			k += 2
			m += 2
			a += k
			if m == n / 2 + 1:
				m += 2
			b += m
			c.append(k)
			d.append(m)
			if len(c) == n / 2:
				l = c + d
				for i in range(n):
					print(l[i], end=' ')
				print('')
				break


for _ in range(int(input())):
	n = int(input())
	t = n // 2
	if t % 2 != 0:
		print('NO')
	else:
		s1 = []
		s2 = []
		k = 2
		p = 1
		for i in range(1, t):
			s1.append(k)
			k += 2
			s2.append(p)
			p += 2
		l = 2 * t
		r = l + t - 1
		s1 += [l]
		s2 += [r]
		print('YES')
		print(*list(s1 + s2))


t = int(input())
for _ in range(t):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = 2 * n * [0]
		s = 0
		for i in range(n):
			a[i] = 2 * (i + 1)
			s += a[i]
		for i in range(n - 1):
			a[n + i] = 2 * i + 1
			s -= a[n + i]
		a[-1] = s
		print(' '.join(list(map(lambda x: str(x), a))))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		l = [2 * x for x in range(1, n + 1) if 2 * x <= n]
		m = [2 * x + 1 for x in range(n // 2) if x + 1 < n // 2]
		l.extend(m)
		l.append(3 * n // 2 - 1)
		print(*l, end='\n')


t = int(input())
for i1 in range(t):
	n = int(input()) // 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i2 in range(2, 2 * n + 1, 2):
			print(i2, end=' ')
		for i2 in range(1, 2 * (n - 1), 2):
			print(i2, end=' ')
		print(3 * n - 1)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('No')
	else:
		z = n
		x = []
		y = []
		for i in range(1, n // 2):
			x.append(2 * i)
			y.append(2 * i - 1)
			z = z + x[i - 1] - y[i - 1]
		x.append(n)
		y.append(z)
		x = x + y
		print('Yes')
		for j in x:
			print(j, end=' ')
		print()


no_test_cases = int(input())
for test_case in range(no_test_cases):
	length = int(input())
	even = [2 * x for x in range(1, int(length / 2) + 1)]
	odd = [x for x in range(1, length - 2, 2)]
	missing = sum(even) - sum(odd)
	if missing % 2 == 0:
		print('NO')
	else:
		print('YES')
		odd.append(missing)
		even.extend(odd)
		answer = [str(x) for x in even]
		print(' '.join(answer))


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	nk = stdin.readline().split()
	n = int(nk[0])
	k = int(nk[1])
	a = [int(x) for x in stdin.readline().split()]
	mylist = [0] * 2 * k
	b = []
	for x in range(n // 2):
		b.append([a[x], a[n - x - 1]])
	for x in b:
		mylist[1] += 2
		mylist[min(x)] -= 1
		mylist[sum(x) - 1] -= 1
		if sum(x) < 2 * k:
			mylist[sum(x)] += 1
		if max(x) + k < 2 * k:
			mylist[max(x) + k] += 1
	for x in range(1, 2 * k):
		mylist[x] += mylist[x - 1]
	c = min(mylist[1:])
	stdout.write(str(c) + '\n')


q = int(input())
for i in range(q):
	x = int(input())
	a = []
	b = []
	if x % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(1, x + 1):
			if j % 2 == 0:
				a.append(j)
			else:
				b.append(j)
		b.pop()
		b.append(sum(a) - sum(b))
		print(*a + b)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		even = [e for e in range(2, n + 1, 2)]
		odd = [k - 1 for k in even]
		odd.pop()
		compliment = sum(even) - sum(odd)
		result = even + odd
		result.append(compliment)
		print(*result)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(la, lb) = ([], [])
	(a, b) = (2, 1)
	if n // 2 % 2 != 0:
		print('NO')
	else:
		for i in range(n // 2):
			la.append(a)
			a = a + 2
			lb.append(b)
			b = b + 2
		lb[n // 2 - 1] = lb[n // 2 - 1] + n // 2
		c = ''
		print('YES')
		for j in la + lb:
			c = c + (str(j) + ' ')
		print(c)


m = int(input())
for x in range(m):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		i = 2
		while i <= n:
			l.append(i)
			i = i + 2
		for e in range(n // 2 - 1):
			l.append(l[e] - 1)
		l.append(l[n // 2 - 1] + n // 2 - 1)
		l = list(map(str, l))
		print(' '.join(l))


t = int(input())
N = []
for i in range(t):
	N.append(int(input()))

def main(n):
	la = []
	ra = []
	for i in range(int(n / 2)):
		la.append(2 * (i + 1))
	s = -1
	while len(ra) < int(n / 2) - 1:
		s += 2
		ra.append(s)
	ra.append(sum(la) - sum(ra))
	if ra[-1] % 2 == 0:
		print('NO')
	else:
		print('YES')
		a = la + ra
		print(' '.join(map(str, a)))
for i in range(t):
	main(N[i])


F = int(input())
for i in range(0, F):
	k = int(input()) // 2
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		i = 2
		while i <= 2 * k:
			print(str(i), end=' ')
			i += 2
		i = 1
		while i < 2 * k - 1:
			print(str(i), end=' ')
			i += 2
		print(3 * k - 1)


def main(n):
	if n / 2 % 2:
		return 'NO'
	print('YES')
	(evens, odds) = ('', '')
	(evenSum, oddSum) = (0, 0)
	for i in range(1, n + 1):
		if not i % 2:
			evens += str(i) + ' '
			evenSum += i
		else:
			odds += str(i) + ' '
			oddSum += i
	odds = odds.split()
	odds = odds[:-1] + [str(int(odds[-1]) + evenSum - oddSum)]
	return evens + ' '.join(odds)
for _ in range(int(input())):
	n = int(input())
	print(main(n))


t = int(input())
for case_num in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ans = [i * 2 for i in range(1, n // 2 + 1)]
		for i in range(n // 2 - 1):
			ans.append(ans[i] - 1)
		ans.append(ans[n // 2 - 1] + n // 2 - 1)
		print('YES')
		print(' '.join(map(str, ans)))


T = int(input())
for tc in range(T):
	n = int(input())
	arr = []
	if n // 2 % 2 != 0:
		print('NO')
		continue
	esum = 0
	for i in range(0, n // 2):
		arr.append(str(2 * (i + 1)))
		esum += 2 * (i + 1)
	osum = 0
	for i in range(1, n // 2):
		arr.append(str(2 * i - 1))
		osum += 2 * i - 1
	arr.append(str(esum - osum))
	print('YES')
	print(' '.join(arr))


t = int(input())
for ig in range(t):
	n = int(input())
	r = n // 2
	if r & 1:
		print('NO')
	else:
		print('YES')
		ele = 2
		for i in range(r):
			print(ele, end=' ')
			ele += 2
		ele = 1
		for i in range(r - 1):
			print(ele, end=' ')
			ele += 2
		print(ele + r)


import sys
import math
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
	else:
		print('NO')
		continue
	a = []
	b = []
	val = 2
	for i in range(n // 2):
		a.append(val)
		b.append(val + 1)
		val += 2
	a[-1] = b[-1] + n // 2 - 1
	for i in a:
		print(i, end=' ')
	for i in b:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	Arr = [0] * (2 * k + 2)
	for i in range(n // 2):
		mi = min(l[i], l[n - i - 1])
		ma = max(l[i], l[n - i - 1])
		Arr[mi + ma] -= 1
		Arr[1] += 2
		Arr[mi + 1] -= 1
		Arr[mi + ma + 1] += 1
		Arr[ma + k + 1] += 1
	ans = 2e+18
	for t in range(1, len(Arr)):
		Arr[t] = Arr[t] + Arr[t - 1]
		ans = min(ans, Arr[t])
	print(ans)


nu = int(input())
for i in range(0, nu):
	n = int(input())
	a = []
	b = []
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(2, n // 2 * 2 + 1, 2):
			a.append(i)
		for i in range(1, n // 2 * 2 + 1, 2):
			b.append(i)
		s = sum(a) - sum(b)
		if s == 0:
			c = a + b
			for i in range(0, n - 1):
				print(c[i], end=' ')
			print()
		else:
			d = b[n // 2 - 1] + 2
			for i in range(0, n // 2):
				if d - b[i] == s:
					b[i] = d
					break
			c = a + b
			for i in range(0, n):
				print(c[i], end=' ')
			print()
	else:
		print('NO')


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
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		ans = []
		h = 2
		for i in range(n // 2):
			ans.append(h)
			h += 2
		sa = sum(ans)
		h = 1
		lo = 0
		for i in range(n // 2 - 1):
			ans.append(h)
			lo += h
			h += 2
		ans.append(sa - lo)
		print(*ans)
	else:
		print('NO')


a = [i * 2 for i in range(1, 100002)]
b = [i * 2 + 1 for i in range(100002)]
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		print(*a[:n // 2], end=' ')
		print(*b[:n // 4], end=' ')
		print(*b[n // 4 + 1:n // 2 + 1], end=' ')
		print()


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	n = inp(1)
	if n % 4 == 0:
		print('YES')
		ans = [k for k in range(2, n + 1, 2)]
		for k in range(2, n + 1, 2):
			if k <= n // 2:
				ans.append(k - 1)
			else:
				ans.append(k + 1)
		print(*ans)
	else:
		print('NO')


from sys import *
input = stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [0] * (2 * k + 1)
	c = [0] * (2 * k + 1)
	mn = 1e+18
	for i in range(n // 2):
		(x, y) = (a[i], a[n - i - 1])
		(x, y) = (min(x, y), max(x, y))
		sn = x + y
		if sn + 1 <= 2 * k:
			b[sn + 1] += 1
		if sn - 1 >= 0:
			c[sn - 1] += 1
		if sn - y >= 0:
			c[sn - y] += 1
		if sn + (k - x) + 1 <= 2 * k:
			b[sn + (k - x) + 1] += 1
	for i in range(1, 2 * k + 1):
		b[i] += b[i - 1]
	for i in range(2 * k - 1, -1, -1):
		c[i] += c[i + 1]
	for i in range(2 * k + 1):
		mn = min(mn, b[i] + c[i])
	print(mn)


from collections import Counter
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()):
		(n, k) = MI()
		aa = LI()
		cnt = [0] * (2 * k + 2)
		for i in range(n // 2):
			(a, b) = (aa[i], aa[n - 1 - i])
			if a > b:
				(a, b) = (b, a)
			cnt[0] += 2
			cnt[a + 1] += -1
			cnt[a + b] += -1
			cnt[a + b + 1] += 1
			cnt[b + k + 1] += 1
		for i in range(2 * k + 1):
			cnt[i + 1] += cnt[i]
		print(min(cnt))
main()


t = int(input())
for _ in range(t):
	h = int(input())
	if h % 4 != 0:
		print('NO')
	else:
		aa = [i for i in range(2, h + 1, 2)]
		aa.extend([e for e in range(1, h, 2)])
		aa[-1] += h // 2
		print('YES')
		print(*aa)


import sys
for _ in range(int(input())):
	N = int(input())
	if N // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, N // 2 + 1):
			print(2 * i, end=' ')
		for i in range(1, N // 2 + 1):
			if i <= N // 4:
				print(2 * i - 1, end=' ')
			else:
				print(2 * i + 1, end=' ')
		print('')


for _ in range(int(input())):
	ns = int(input())
	if ns % 4 != 0:
		print('NO')
	else:
		arr = [x for x in range(2, ns + 1, 2)]
		arr.extend([x for x in range(1, ns, 2)])
		arr[-1] += ns // 2
		print('YES')
		print(*arr)


t = int(input())
for i in range(t):
	massif = []
	n = int(input())
	if n % 4 == 0:
		print('YES')
		massif = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n - 1, 2)] + [n + n // 2 - 1]
		print(*massif)
	else:
		print('NO')


n = int(input())
a = [[int(j) for j in input().split()] for i in range(n)]
for i in range(n):
	if a[i][0] % 4 == 0:
		print('YES')
		q = list()
		d = a[i][0]
		d = int(d / 2)
		for i in range(1, d + 1):
			q.append(i * 2)
		for i in range(1, d):
			q.append(i * 2 - 1)
		q.append(d * 3 - 1)
		for i in q:
			print(i, end=' ')
	else:
		print('\n', 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	if m % 2 == 1:
		print('NO')
	else:
		even = [2 * i for i in range(1, m + 1)]
		odd = [2 * i - 1 for i in range(1, m)]
		last = [sum(even) - sum(odd)]
		result = even + odd + last
		print('YES')
		print(*result)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = [j for j in range(2, n + 1, 2)]
		b = [j for j in range(1, n + 1, 2)]
		b[-1] += n // 2
		print('YES')
		print(*a, *b)


from collections import defaultdict as dd
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	nl = list(map(int, input().split()))
	kl = [0] * (2 * k + 2)
	cnt = dd(int)
	for i in range(n // 2):
		cnt[nl[i] + nl[n - i - 1]] += 1
		kl[min(nl[i], nl[n - i - 1]) + 1] += 1
		kl[max(nl[i], nl[n - i - 1]) + k + 1] -= 1
	for i in range(1, len(kl) - 1):
		kl[i] += kl[i - 1]
	ans = n // 2
	for x in cnt:
		ans = min(ans, kl[x] - cnt[x] + (n // 2 - kl[x]) * 2)
	print(ans)


from sys import stdin

def solve(n):
	if n // 2 % 2 == 0:
		print('YES')
		(a, b) = ([], [])
		h = 4
		for u in range(n // 4):
			a.append(h)
			b.append(a[-1] - 1)
			h += 4
			a.append(h)
			b.append(a[-1] + 1)
			h += 4
		for i in a:
			print(i, end=' ')
		for i in b:
			print(i, end=' ')
		print()
	else:
		print('NO')
	return

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		solve(n)
main()


for _ in range(int(input())):
	n = int(input())
	co = 0
	count = 0
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print(2 * i + 2, end=' ')
			co += 2 * i + 2
		for j in range(n // 2):
			if j != n // 2 - 1:
				print(2 * j + 1, end=' ')
				count += 2 * j + 1
			else:
				print(abs(count - co))


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		evens = [2 * (i + 1) for i in range(n // 2)]
		num = sum(evens)
		odds = [2 * (i + 1) - 1 for i in range(n // 2 - 1)]
		odds.append(num - sum(odds))
		print('YES')
		print(*evens + odds)
	else:
		print('NO')


from sys import stdin
import sys
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	arr = list(map(int, stdin.readline().split()))
	count = [0] * (2 * k + 1)
	for i in range(n // 2):
		count[arr[i] + arr[n - 1 - i]] += 1
	prev = [0] * (2 * k + 2)
	for i in range(n // 2):
		left = min(arr[i], arr[n - 1 - i]) + 1
		right = max(arr[i], arr[n - i - 1]) + k
		prev[left] += 1
		prev[right + 1] -= 1
	for i in range(1, 2 * k + 2):
		prev[i] += prev[i - 1]
	ans = 1000000
	for i in range(2, 2 * k + 1):
		ans = min(ans, prev[i] - count[i] + (n // 2 - prev[i]) * 2)
	print(ans)


a = int(input())
w = 0
while w < a:
	w = w + 1
	n = int(input())
	p = 1
	t = 1
	sum = 0
	while t <= n / 2:
		p = p + 1
		t = t + 1
		sum = sum + 2 * p
	p = 1
	while t > n / 2 and t < n:
		t = t + 1
		sum = sum - (2 * p - 1)
		p = p + 1
	if t == n:
		if sum % 2 == 1:
			print('YES')
		else:
			print('NO')
			continue
	p = 1
	t = 1
	sum = 0
	while t <= n / 2:
		print(2 * p, end=' ')
		sum = sum + 2 * p
		p = p + 1
		t = t + 1
	p = 1
	summ = 0
	while t > n / 2 and t < n:
		summ = summ + (2 * p - 1)
		print(2 * p - 1, end=' ')
		t = t + 1
		p = p + 1
	print(sum - summ)


tests = int(input())
while tests > 0:
	tests -= 1
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		continue
	lim = int(n / 2)
	first = [0] * lim
	second = [0] * lim
	cur = 2
	sum1 = 0
	sum2 = 0
	for i in range(0, lim):
		first[i] = cur
		sum1 += cur
		cur += 2
	cur = 1
	for i in range(0, lim):
		second[i] = cur
		sum2 += cur
		cur += 2
	second[lim - 1] += sum1 - sum2
	print('YES')
	for i in range(0, lim):
		print(first[i], end=' ')
	for i in range(0, lim):
		if i == lim - 1:
			print(second[i])
		else:
			print(second[i], end=' ')


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 defaultdict

def segment_count(segments):
	d = defaultdict(int)
	for (start, end) in segments:
		d[start] += 1
		d[end + 1] -= 1
	coordinate = sorted(d.keys())
	counts = [0]
	for key in coordinate:
		counts.append(counts[-1] + d[key])
	return (coordinate, counts)
for case in range(itg()):
	(n, k) = mpint()
	arr = tuple(mpint())
	seg = []
	for i in range(n >> 1):
		(a, b) = (arr[i], arr[~i])
		mn = min(a, b) + 1
		mx = max(a, b) + k
		seg.extend([(mn, a + b), (a + b, mx)])
	print(n - max(segment_count(seg)[1]))


def problemB(n):
	ans = []
	even = 2
	odd = 1
	sumo = 0
	if int(n / 2) % 2 == 1:
		return 'NO'
	else:
		for i in range(int(n / 2)):
			ans.append(even)
			even += 2
		sume = sum(ans)
		for i in range(int(n / 2), n - 1):
			ans.append(odd)
			sumo += odd
			odd += 2
	ans.append(sume - sumo)
	return ans
test = int(input())
for i in range(test):
	n = int(input())
	ad = problemB(n)
	if ad != 'NO':
		print('Yes')
		print(*ad)
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = [2]
		for i in range(1, n // 2):
			a.append(a[i - 1] + 4)
		flag = 0
		for i in range(n // 2, n):
			if flag == 0:
				a.append(a[i - n // 2] - 1)
				flag = 1
			else:
				a.append(a[i - n // 2] + 1)
				flag = 0
		for ar in a:
			print(ar, end=' ')
		print('')
	else:
		print('NO')


t = int(input())
numlist = []
eve = []
odd = []
for i in range(t):
	numlist.append(int(input()))
for n in numlist:
	if n % 4 != 0:
		print('NO')
	else:
		eve = []
		odd = []
		for j in range(1, n // 2 + 1):
			eve.append(2 * j)
		for j in range(1, n // 2):
			odd.append(2 * j - 1)
		odd.append(sum(eve) - sum(odd))
		lt = eve + odd
		print('YES')
		for j in lt:
			print(j, end=' ')
		print()


for _ in range(int(input().strip())):
	(n, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	common_values = [0 for _ in range(2 * k + 2)]
	for i in range(n // 2):
		(a, b) = (nums[i], nums[n - 1 - i])
		common_values[a + b - max(a, b) + 1] -= 1
		common_values[a + b] -= 1
		common_values[a + b + 1] += 1
		common_values[a + b - min(a, b) + k + 1] += 1
	common_values[1] = n
	minimum = n
	for i in range(2, 2 * k + 1):
		common_values[i] += common_values[i - 1]
		minimum = min(minimum, common_values[i])
	print(minimum)


import sys
input = sys.stdin.buffer.readline
from itertools import accumulate
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	B = [0] * (2 * k + 2)
	for i in range(n // 2):
		m = min(A[i], A[n - 1 - i])
		M = max(A[i], A[n - 1 - i])
		s = A[i] + A[n - 1 - i]
		l = m + 1
		r = M + k
		B[0] += 2
		B[l] -= 2
		B[r + 1] += 2
		B[-1] -= 2
		B[l] += 1
		B[s] -= 1
		B[s + 1] += 1
		B[r + 1] -= 1
	C = list(accumulate(B))
	ans = 10 ** 18
	for i in range(2, 2 * k + 1):
		ans = min(ans, C[i])
	print(ans)


t = input()
for _ in range(int(t)):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		even_half = n // 2 * (n // 2 + 1)
		odd_half = (n // 2 + 1) ** 2
		left = odd_half - even_half
		num = 2
		for i in range(n // 2):
			print(num, end=' ')
			num += 2
		num = 1
		for i in range(n // 2 + 1):
			if num != left:
				print(num, end=' ')
			num += 2
		print('')


for test in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		lst1 = []
		lst2 = []
		flag = 0
		cnt = 0
		for i in range(2, n + 1, 2):
			lst1.append(i)
			if cnt == n // 4:
				flag = 1
			if flag == 0:
				lst2.append(i - 1)
				i += 1
			elif flag == 1:
				lst2.append(i + 1)
			cnt += 1
		print(*lst1 + lst2)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		s = 0
		arr = []
		for i in range(1, n // 2 + 1):
			arr.append(i * 2)
			s += i * 2
		for i in range(1, n // 2):
			arr.append(i * 2 - 1)
			s -= i * 2 - 1
		arr.append(s)
		print(*arr)


for _ in range(int(input())):
	n = int(input())
	z = n // 2
	if z % 2 != 0:
		print('NO')
	else:
		print('YES')
		(sum, sum1) = (0, 0)
		for i in range(2, n + 1, 2):
			sum += i
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
			sum1 += i
		else:
			print(sum - sum1)


for t in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		x = n // 2
		(even, odd) = ([], [])
		for i in range(1, x + 1):
			even.append(2 * i)
			odd.append(2 * i - 1)
		odd[-1] += x
		ans = even + odd
		print('YES')
		print(*ans)


t = int(input())
if 1 <= t <= 10 ** 4:
	for i in range(t):
		n = int(input())
		m = n / 2
		m = int(m)
		a = 0
		li = []
		p = [1]
		if m != 2 and m % 2 != 0:
			print('NO')
		elif m % 2 == 0:
			for i in range(m):
				a += 2
				li.append(a)
			r = sum(li)
			s = 1
			for i in range(m - 2):
				s += 2
				p.append(s)
			ll = sum(p)
			v = r - ll
			p.append(v)
			print('YES')
			print(*li + p, sep=' ')


n = int(input())
for i in range(n):
	x = int(input())
	if x % 4 != 0:
		print('NO')
	else:
		print('YES')
		l1 = []
		l2 = []
		m = 2
		for j in range(x // 4):
			l1.append(str(m))
			l1.append(str(m + 2))
			l2.append(str(m + 3))
			l2.append(str(m - 1))
			m += 6
		print(' '.join(l1), end=' ')
		print(' '.join(l2))


c = int(input())
for _ in range(c):
	n = int(input())
	if n % 4 == 0:
		arr = []
		count_chet = n // 2
		i_ch = 1
		for _ in range(count_chet // 2):
			arr.append(2 * i_ch)
			arr.append(2 * (i_ch + 2))
			i_ch += 3
		i_ch = 1
		for _ in range(count_chet // 2):
			arr.append(2 * i_ch + 1)
			arr.append(2 * (i_ch + 1) + 1)
			i_ch += 3
		print('YES')
		print(' '.join((str(x) for x in arr)))
	else:
		print('NO')


num = input()
num = int(num)
for i in range(num):
	t = int(input())
	if t % 4 != 0:
		print('NO')
	else:
		print('YES')
		for k in range(t // 2):
			print((k + 1) * 2, end=' ')
		for k in range(t // 4):
			print(k * 2 + 1, end=' ')
		stage = t // 2 + 3
		for k in range(t // 4):
			print(k * 2 + stage, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	m = 2
	k = 1
	l = []
	if n % 2 != 0 or n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			l.append(m)
			m += 2
		for i in range(n // 2 - 1):
			l.append(k)
			k += 2
		s1 = sum(l[0:n // 2])
		s2 = sum(l[n // 2:n - 1])
		l.append(s1 - s2)
		for i in l:
			print(i, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l1 = []
		l2 = []
		for i in range(1, n // 2 + 1):
			l1.append(2 * i)
		for i in range(0, n // 2 - 1):
			l2.append(2 * i + 1)
		l2.append(sum(l1) - sum(l2))
		ans = l1 + l2
		print(*ans)


T = int(input())
for _ in range(T):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		sum = 0
		count = 2
		for i in range(int(n / 2)):
			sum += count
			print(count, end=' ')
			count += 2
		count = 1
		oddSum = 0
		for i in range(int(n / 2) - 1):
			oddSum += count
			print(count, end=' ')
			count += 2
		print(sum - oddSum)
	else:
		print('NO')


import sys
t = int(sys.stdin.readline().split()[0])
tests = []
for line in sys.stdin:
	for word in line.split():
		tests.append(int(word))
for test in tests:
	if int(test % 4) != 0:
		print('NO')
	else:
		print('YES')
		first_numbers_count = int(test / 2)
		first_array = [x * 2 for x in range(1, first_numbers_count + 1)]
		second_array = [x * 2 - 1 for x in range(1, first_numbers_count)]
		second_array.append(sum(first_array) - sum(second_array))
		print(*first_array, end='')
		print(' ', end='')
		print(*second_array, end='')
		print()


for t in range(int(input())):
	n = int(input())
	half = n // 2
	if half % 2:
		print('NO')
	else:
		a = [0] * n
		evensum = 0
		t = 2
		for i in range(half):
			a[i] = t
			evensum += t
			t += 2
		t = 1
		for i in range(half, n - 1):
			a[i] = t
			evensum -= t
			t += 2
		a[-1] = evensum
		print('YES')
		print(' '.join(map(str, a)))


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		(eve, odd) = (2, 1)
		arr = [2] + [0] * (n // 2 - 1) + [1] + [0] * (n // 2 - 1)
		for i in range(1, n // 2):
			arr[i] = arr[i - 1] + 2
			eve += arr[i]
		for i in range(n // 2 + 1, n - 1):
			arr[i] = arr[i - 1] + 2
			odd += arr[i]
		summ = eve - odd
		arr[n - 1] = summ
		print(*arr)
t = int(input())
for i in range(t):
	solve()


for t in range(int(input())):
	n = int(input())
	liev = []
	org = []
	liod = []
	even = 2
	odd = 1
	add = 0
	oddd = 0
	elle = 0
	odde = 0
	if n % 4 != 0:
		print('NO')
	if n % 4 == 0:
		q = int(n / 2)
		for i in range(q):
			ele = even + 2 * i
			add += ele
			liev.append(ele)
		for j in range(q - 1):
			odde = odd + 2 * j
			oddd += odde
			liod.append(odde)
		new = add - oddd
		liod.append(new)
		print('YES')
		for x in range(len(liev)):
			org.append(liev[x])
		for y in range(len(liod)):
			org.append(liod[y])
		print(*org)


t = int(input())
while t:
	n = int(input())
	k = n / 2
	if k % 2 != 0:
		print('NO')
	else:
		li = [int(i) for i in range(1, n + 1) if i % 2 == 0]
		li1 = []
		for i in range(1, li[len(li) - 2]):
			if i % 2 != 0:
				li1.append(i)
		s = li[len(li) - 1] + len(li1)
		li1.append(s)
		print('YES')
		for i in li:
			print(i, end=' ')
		for i in li1:
			print(i, end=' ')
		print()
	t -= 1


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		a = []
		b = []
		for i in range(1, n + 1):
			if i == n - 1:
				continue
			elif i % 2 == 0:
				a.append(i)
			else:
				b.append(i)
		b.append(n + (n // 2 - 1))
		a = a + b
		print(*a, sep=' ')
	else:
		print('NO')


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 % 2 == 0:
		print('YES')
		A = [0 for _ in range(N)]
		for i in range(N // 2):
			A[i] = (i + 1) * 2
		for i in range(N // 4):
			A[N // 2 + i] = A[i] - 1
		for i in range(N // 4):
			A[N // 2 + N // 4 + i] = A[i + N // 4] + 1
		print(*A, sep=' ')
	else:
		print('NO')

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


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		e = []
		o = []
		for i in range(1, n + 1):
			if i % 2 != 0:
				o.append(i)
			else:
				e.append(i)
		o.pop()
		s = sum(e) - sum(o)
		o.append(s)
		ans = e + o
		print(*ans)
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	k = int(n / 2)
	if k % 2 != 0:
		print('NO')
	else:
		li = []
		x = 0
		for i in range(k):
			x += 2
			li.append(x)
		i = 0
		y = 1
		while i < k - 1:
			i += 1
			li.append(y)
			y += 2
		li.append(y + k)
		print('YES')
		for i in li:
			print(i, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	chk = True
	if n // 2 % 2 != 0:
		chk = False
		print('NO')
		continue
	k = 1
	l = list(range(k, k + n + 1, 2))
	r = list(range(k + 1, k + n + 1, 2))
	l.remove(k + n // 2)
	ans = r + l
	print('YES')
	for i in ans:
		print(i, end=' ')
	print()


import math
t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	x = 2
	c = 0
	for j in range(n // 2):
		arr.append(x)
		x += 2
	s = sum(arr)
	y = 1
	for j in range(n // 2 - 1):
		arr.append(y)
		s -= y
		y += 2
	if s % 2 == 0:
		print('NO')
	else:
		arr.append(s)
		print('YES')
		print(*arr)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

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

def ddl():
	return collections.defaultdict(list)

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):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

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 prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	n = ii()
	if n % 4:
		print('NO')
	else:
		even = [i for i in range(2, n + 1, 2)]
		odd = [i for i in range(1, n // 2, 2)] + [i for i in range(n // 2 + 3, n + 2, 2)]
		print('YES')
		print(*even + odd)


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0 and n >= 4:
		print('YES')
		l = []
		m = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				l += [i]
			else:
				m += [i]
		m[-1] += n // 2
		l = l + m
		print(*l)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(range(2, n + 1, 2)) + list(range(1, n, 2))
	a[-1] += n // 2
	print(['YES', 'NO'][a[-1] & 1 == 0])
	if a[-1] & 1:
		print(*a)


for i in range(int(input())):
	n = int(input())
	c = 0
	k = 0
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('Yes')
		for j in range(1, n + 1):
			if j % 2 == 0:
				print(j, end=' ')
				c += j
		for j in range(1, n - 1):
			if j % 2 != 0:
				print(j, end=' ')
				k += j
		print(c - k)


t = int(input())
for i in range(t):
	a = int(input())
	if a % 4 == 0:
		ans = []
		ans1 = []
		ans2 = []
		for j in range(2, a + 1, 2):
			ans1.append(j)
		for j in range(1, a + 1, 2):
			if j == a - 1:
				ans2.append(j + int(a // 2))
			else:
				ans2.append(j)
		print('YES')
		ans = list(ans1 + ans2)
		print(*ans)
	else:
		print('NO')


t = input()
t = int(t)
while t:
	t -= 1
	n = input()
	n = int(n)
	half = n // 2
	if half % 2 != 0:
		print('NO')
	else:
		ans = []
		num = 2
		flag = 0
		for i in range(n // 4):
			ans.append(num)
			if flag == 0:
				num = num + 2
				flag = 1
			else:
				num = num + 4
				flag = 0
			ans.append(num)
			num = num + 2
		flag = 1
		num = 1
		for i in range(n // 4):
			ans.append(num)
			if flag == 0:
				num = num + 2
				flag = 1
			else:
				num = num + 4
				flag = 0
			ans.append(num)
			num = num + 2
		print('YES')
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		lst = []
		for i in range(1, n // 2 + 1):
			lst.append(2 * i)
		for j in range(1, n // 2):
			lst.append(2 * j - 1)
		total = (n ** 2 + 2 * n) // 4
		a = 2 * total - sum(lst)
		lst.append(a)
		print(' '.join((str(x) for x in lst)))


T = int(input())
for t in range(T):
	n = int(input())
	left = [2 * (i + 1) for i in range(n // 2)]
	right = [e - 1 for e in left[:-1]]
	missing = sum(left) - sum(right)
	if missing > 0 and missing % 2 == 1 and (missing not in right):
		print('YES')
		print(' '.join(map(str, left + right + [missing])))
	else:
		print('NO')


import math
t = int(input())
for test in range(t):
	n = int(input())
	x = n // 2
	if x % 2 == 1:
		print('NO')
	else:
		print('YES')
		arr = [0] * n
		s = 0
		val = 6
		for i in range(x):
			arr[i] = val
			s += val
			val += 2
		val = 1
		for i in range(x, n - 1):
			arr[i] = val
			s -= val
			val += 2
		arr[n - 1] = s
		for i in arr:
			print(i, end=' ')
		print()


T = int(input())
for xx in range(T):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		arr = [0 for i in range(n)]
		sup = n + 1
		for i in range(n // 2):
			arr[i] = 2 * (i + 1)
		for i in range(n // 2, n - 1):
			arr[i] = 2 * (i - n // 2) + 1
		arr[n - 1] = arr[n - 2] + 2 + n // 2
		print('YES')
		js = ' '.join([str(v) for v in arr])
		print(js)


def run(lst, n, k):
	ans = float('inf')
	cnt = [0 for i in range(int(2 * k + 1))]
	for i in range(int(n / 2)):
		soma = lst[i] + lst[n - i - 1]
		cnt[soma] += 1
	pref = [0 for i in range(int(2 * k + 2))]
	for i in range(int(n / 2)):
		menor = min(lst[i] + 1, lst[n - i - 1] + 1)
		maior = max(lst[i] + k, lst[n - i - 1] + k)
		pref[menor] += 1
		pref[maior + 1] -= 1
	for i in range(1, len(pref) - 1):
		pref[i] += pref[i - 1]
	for i in range(1, len(pref) - 1):
		pref[i] = n - cnt[i] - pref[i]
	print(min(pref[2:-1]))
i = int(input())
for _ in range(i):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	run(lst, n, k)


out = []
for i in range(int(input())):
	n = int(input())
	even = []
	odd = []
	even_s = ''
	odd_s = ''
	for i in range(2, n + 1):
		if i % 2 == 0:
			even.append(i)
	sum_even = sum(even)
	if len(even) % 2 == 0:
		for i in range(1, sum_even + 1):
			if i % 2 != 0:
				odd.append(i)
				if len(odd) == len(even) - 1:
					odd.append(sum_even - sum(odd))
					break
		for i in even:
			even_s += str(i) + ' '
		for i in odd:
			odd_s += str(i) + ' '
		out.append('YES')
		out.append(even_s + odd_s)
	else:
		out.append('NO')
for i in out:
	print(i, end='\n')


t = int(input())
result_list = []
while t > 0:
	n = int(input())
	if n % 4 == 0:
		result_list.append('YES')
		a = list(range(2, n + 1, 2))
		b = list(range(1, n - 2, 2))
		c = sum(a) - sum(b)
		b.append(c)
		a.extend(b)
		result_list.append(a)
	else:
		result_list.append('NO')
	t -= 1
for i in result_list:
	if isinstance(i, list):
		for k in i:
			print(k, end=' ')
		print()
	else:
		print(i)


import sys
cases = int(input())
for case in range(cases):
	size = int(input())
	if size / 2 % 2 == 0:
		print('YES')
		amt = int(size / 2)
		evenArray = 0
		for y in range(1, amt + 1):
			sys.stdout.write(str(y * 2) + ' ')
			evenArray += y * 2
		for z in range(1, amt):
			sys.stdout.write(str(z * 2 - 1) + ' ')
			evenArray -= z * 2 - 1
		sys.stdout.write(str(evenArray) + '\n')
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = [int(j) for j in input().split()]
	l = [int(j) for j in input().split()]
	a = 0
	b = 0
	s = [0] * (2 * k + 1)
	t = [0] * (2 * k + 1)
	pre = [0] * (2 * k)
	suf = [0] * (2 * k)
	for i in range(n // 2):
		tmp = l[i] + l[n - i - 1]
		s[tmp] += 1
		pre[min(l[i], l[n - i - 1])] += 1
		suf[max(l[i], l[n - i - 1])] += 1
	for i in range(1, len(pre)):
		pre[i] += pre[i - 1]
		suf[i] += suf[i - 1]
	ans = n
	for sum_ in range(1, 2 * k + 1):
		tmp = suf[max(sum_ - k - 1, 0)] + n // 2 - s[sum_] + n // 2 - pre[max(sum_ - 1, 0)]
		ans = min(ans, tmp)
	print(ans)


def showResult(n):
	numbers = []
	sum = int(0)
	for i in range(int(n / int(2))):
		c = (i + int(1)) * int(2)
		numbers.append(c)
		sum += c
	for i in range(int(n / int(2)) - int(1)):
		c = i * int(2) + int(1)
		numbers.append(c)
		sum -= c
	numbers.append(sum)
	print(*numbers, sep=' ')
n = int(input())
numbers = []
for i in range(n):
	numbers.append(int(input()))
for i in numbers:
	if i / int(2) % int(2) == int(1):
		print('NO')
	else:
		print('YES')
		showResult(i)


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		l = []
		print('YES')
		n = n // 2
		for i in range(1, n + 1):
			l.append(2 * i)
		for i in range(1, n):
			l.append(2 * i - 1)
		l.append(3 * n - 1)
		print(*l)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

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

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve():

	def add(i, w):
		x = i + 1
		while x <= size:
			bit[x - 1] += w
			x += x & -x
		return

	def sum(i):
		res = 0
		x = i + 1
		while x > 0:
			res += bit[x - 1]
			x -= x & -x
		return res
	(n, k) = LI()
	a = LI()
	size = 2 * k + 1
	bit = [0 for _ in range(2 * k + 1)]
	add(0, n)
	d = defaultdict(int)
	for i in range(n // 2):
		m = a[i] + a[n - i - 1]
		mr1 = max(a[i], a[n - i - 1]) + k
		ml1 = min(a[i], a[n - i - 1]) + 1
		d[m + 1] += 1
		d[mr1 + 1] += 1
		d[m] -= 1
		d[ml1] -= 1
	for (key, value) in d.items():
		if value:
			add(key, value)
	tmp = inf
	for i in range(2 * k + 1):
		t = sum(i)
		if t < tmp:
			tmp = t
	print(tmp)
	return
for _ in range(II()):
	solve()


for i in range(int(input())):
	n = int(input())
	l = []
	k = []
	if n % 4 == 0:
		print('YES')
		for i in range(1, n - 1):
			if i % 2 == 0:
				l.append(i)
			else:
				k.append(i)
		l.append(n)
		k.append(sum(l) - sum(k))
		print(' '.join(map(str, l + k)))
	else:
		print('NO')


def solve():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	cnt = [0] * (2 * k + 2)
	sum = [0] * (2 * k + 2)
	for i in range(0, n // 2):
		sum[a[i] + a[n - 1 - i]] += 1
	for i in range(0, n // 2):
		cnt[min(a[i], a[n - 1 - i]) + 1] += 1
		cnt[max(a[i], a[n - 1 - i]) + k + 1] -= 1
	for i in range(1, 2 * k + 1):
		cnt[i] += cnt[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		sc = cnt[i]
		nc = sum[i]
		dc = n // 2 - cnt[i]
		ans = min(ans, sc + 2 * dc - nc)
	print(ans)
t = int(input())
for _ in range(0, t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	arr1 = [x for x in range(1, n + 1) if x % 2 == 0]
	avg = sum(arr1) // len(arr1)
	if avg % 2 == 1:
		print('YES')
		arr2 = [avg + 2 * x for x in range(-n // 4, n // 4 + 1) if x != 0]
		final = arr1 + arr2
		print(' '.join(map(str, final)))
	else:
		print('NO')


import math
test = int(input())
for tes in range(test):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(2, n + 1, 2):
			print(j, end=' ')
		for h in range(1, n - 1, 2):
			print(h, end=' ')
		print(h + 2 + n // 2)


for nt in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		(a, b) = (0, 0)
		for i in range(n // 2):
			print(2 * (i + 1), end=' ')
			a += 2 * (i + 1)
		for i in range(n // 2 - 1):
			print(2 * i + 1, end=' ')
			b += 2 * i + 1
		print(a - b)


for q in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		s = 0
		s1 = 0
		print('YES')
		ans = []
		for i in range(0, n // 2):
			c = 2 * (i + 1)
			s += c
			ans.append(c)
		for i in range(n // 2, n - 1):
			c = 2 * (i - n // 2 + 1) - 1
			s1 += c
			ans.append(c)
		d = s - s1
		ans.append(d)
		print(*ans)


for t in range(int(input())):
	n = int(input())
	n //= 2
	if n % 2:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(n // 2):
			l.append(str(2 + 8 * i))
			l.append(str(4 + 8 * i))
		for i in range(n // 2):
			l.append(str(1 + 8 * i))
			l.append(str(5 + 8 * i))
		print(' '.join(l))


t = int(input())
for T in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		odds = [i * 2 + 1 for i in range(n // 2)]
		evens = [n // 2 - n + 2 * i for i in range(n // 4)] + [n // 2 + n - 2 * i for i in range(n // 4)]
		mini = min(evens)
		for e in evens:
			print(e - mini + 2, end=' ')
		for o in odds:
			print(o - mini + 2, end=' ')
		print()
	else:
		print('NO')


for t in range(int(input())):
	m = int(input())
	a = m // 2 - 1
	if m / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, m // 2 + 1):
			print(2 * i, end=' ')
		for j in range(1, m // 2):
			print(2 * j - 1, end=' ')
		print(a + 2 * i)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		half = n // 2
		mx = 2 * half
		l = []
		esum = 0
		for x in range(2, mx + 1, 2):
			esum += x
			l.append(x)
		count = 1
		osum = 0
		for x in range(half - 1):
			l.append(count)
			osum += count
			count += 2
		l.append(esum - osum)
		print('YES')
		print(*l)


def f(n):
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	print(*[2 * i + 2 for i in range(n >> 1)], end=' ')
	print(*[2 * i + 1 for i in range((n >> 1) - 1)], n - 1 + (n >> 1))
t = int(input())
for i in range(t):
	n = int(input())
	f(n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	x = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		x[k + max(l[i], l[n - 1 - i]) + 1] -= 1
		x[1 + min(l[i], l[n - 1 - i])] += 1
	low = 0
	high = 0
	maxfreq = 0
	for i in range(1, 2 * k + 1):
		x[i] += x[i - 1]
	for i in range(1, 2 * k + 1):
		if x[i] > maxfreq:
			maxfreq = x[i]
			(low, high) = (i, i)
		elif x[i] == maxfreq:
			high = i
	d = {}
	maxchanges = 0
	for i in range(n // 2):
		s = l[i] + l[n - 1 - i]
		if s in d:
			d[s] += 1
		else:
			d[s] = 1
		changes = d[s] + x[s]
		if changes > maxchanges:
			maxchanges = changes
	print(n - max(maxchanges, max(x)))


import sys
input = sys.stdin.readline
for test in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		A = []
		sum = 0
		for i in range(1, n // 2 + 1):
			A.append(i * 2)
			sum += i * 2
		for i in range(1, n // 2 + 1):
			A.append(i * 2 - 1)
			sum -= i * 2 - 1
		A[n - 1] += sum
		print(*A)


cnt = [0] * int(400000.0 + 5)
f = [0] * int(400000.0 + 5)
q = int(input())
while q > 0:
	q -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for i in range(n // 2):
		j = n - 1 - i
		if a[i] > a[j]:
			temp = a[i]
			a[i] = a[j]
			a[j] = temp
		cnt[max(a[i] + 1, 2)] -= 1
		cnt[min(a[j] + k + 1, 2 * k + 1)] += 1
		f[a[i] + a[j]] += 1
	temp = n
	res = int(2000000000.0)
	for i in range(2, 2 * k + 1):
		temp += cnt[i]
		res = min(res, temp - f[i])
	for i in range(n // 2):
		j = n - 1 - i
		if a[i] > a[j]:
			swap(a[i], a[j])
		cnt[max(a[i] + 1, 2)] = 0
		cnt[min(a[j] + k + 1, 2 * k + 1)] = 0
		f[a[i] + a[j]] = 0
	print(res)


t = int(input())
for k in range(t):
	n = int(input())
	if n % 2 != 0:
		print('NO')
	else:
		o = []
		e = []
		z = n // 2
		for i in range(1, z + 1, 1):
			e.append(2 * i)
		for i in range(1, z, 1):
			o.append(2 * i - 1)
		a = sum(e)
		b = sum(o)
		z = a - b
		if (a - b) % 2 != 0 and len(e) == len(o) + 1:
			print('YES')
			for i in range(0, len(e), 1):
				print(e[i], end=' ')
			for i in range(0, len(o), 1):
				print(o[i], end=' ')
			print(z)
		else:
			print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		arr = []
		n = n // 2
		c = 2
		for i in range(n):
			arr.append(c)
			c += 2
		for i in range(n):
			if i >= n // 2:
				arr.append(arr[i] + 1)
			else:
				arr.append(arr[i] - 1)
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		x = n // 4
		(even, odd) = ([], [])
		for i in range(1, x + 1):
			y = 6 * i
			even.append(y - 2)
			even.append(y - 4)
			odd.append(y - 1)
			odd.append(y - 5)
		arr = even + odd
		print(*arr)


t = int(input())
integers = []
for i in range(t):
	integers.append(int(input()))
for integer in integers:
	if integer // 2 % 2 != 0:
		print('NO')
	else:
		fin = []
		a = 2
		count = 0
		for i in range(integer // 2):
			fin.append(a * (i + 1))
		for i in range(integer // 2):
			if i != integer // 2 - 1:
				fin.append(fin[i] - 1)
				count += 1
			else:
				fin.append(fin[i] + count)
		print('YES')
		a = ''
		for i in range(len(fin)):
			a += str(fin[i]) + ' '
		print(a)


for t in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ch = []
		for q in range(2, n + 1, 2):
			ch.append(q)
		nech = []
		for q in range(1, n - 2, 2):
			nech.append(q)
		nech.append(n // 2 + q + 2)
		stroka = ''
		for c in range(len(ch)):
			stroka += str(ch[c])
			stroka += ' '
		for c in range(len(nech) - 1):
			stroka += str(nech[c])
			stroka += ' '
		stroka += str(nech[c + 1])
		print(stroka)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
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')
main()
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	n //= 2
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for i in range(1, n):
		print(i * 2 - 1, end=' ')
	print(3 * n - 1)


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		z = n // 2
		c = 2
		s = 0
		for i in range(n // 2):
			print(c, end=' ')
			s += c
			c += 2
		c = 1
		s1 = 0
		for i in range(n // 2 - 1):
			print(c, end=' ')
			s1 += c
			c += 2
		print(s - s1)


for i in range(int(input())):
	N = int(input())
	if N % 4 != 0:
		print('NO')
	else:
		print('YES')
		A = [(i + 1) * 2 for i in range(N // 2)]
		B = [i * 2 + 1 for i in range(N // 2 - 1)]
		B.append(sum(A) - sum(B))
		print(*A + B)


from sys import setrecursionlimit
from collections import deque
import heapq
import functools
setrecursionlimit(10 ** 6)

def IntInput():
	return int(input())

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

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

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

def modInverse(p, a, m):
	return p % m * pow(a % m, m - 2, m) % m

def compare(item1, item2):
	return item2[0] - item1[0] if item1[0] != item2[0] else item1[1] - item2[1]

def DFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	stack = []
	stack.append(s)
	visited[s] = True
	DFSArray = []
	while stack:
		s = stack.pop()
		DFSArray.append(s)
		flag = 0
		for i in paths[s]:
			if visited[i] == False:
				flag = 1
				stack.append(i)
				visited[i] = True
		if not flag:
			answer[s - 1][1] = 0
	while DFSArray != []:
		s = DFSArray.pop()
		if answer[s - 1][1] < 0:
			answer[s - 1][1] = 0
			for i in paths[s]:
				if answer[i - 1][1] >= 0:
					answer[s - 1][1] += answer[i - 1][1] + 1
	return answer

def BFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	answer[s - 1][0] = 0
	queue = deque()
	queue.append(s)
	visited[s] = True
	while queue:
		s = deque.popleft(queue)
		for i in paths[s]:
			if visited[i] == False:
				queue.append(i)
				answer[i - 1][0] = answer[s - 1][0] + 1
				visited[i] = True
	return answer
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for _ in range(int(input())):
	(n, k) = M_IntInput()
	array = IntArrayInput()
	x = 0
	dictv = {}
	Nochange = [0] * (2 * k + 1)
	OneChange = [0] * (2 * k + 1)
	for i in range(n // 2):
		Nochange[array[i] + array[n - i - 1]] += 1
		OneChange[min(array[i], array[n - i - 1]) + 1] += 1
		if max(array[i], array[n - i - 1]) != k:
			OneChange[k + max(array[i], array[n - i - 1]) + 1] -= 1
	sumV = 0
	ans = 100000000000
	for i in range(1, 2 * k + 1):
		OneChange[i] += OneChange[i - 1]
		ans = min(ans, OneChange[i] - Nochange[i] + (n // 2 - OneChange[i]) * 2)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		a1 = []
		for j in range(1, n // 2 + 1):
			a1.append(2 + (j - 1) * 2)
			a1[j - 1] = int(a1[j - 1])
		a2 = []
		for k in range(1, n // 2 + 1):
			a2.append(1 + (k - 1) * 2)
			a2[k - 1] = int(a2[k - 1])
		diff = sum(a1) - sum(a2)
		a2[-1] = a2[-1] + diff
		a = a1 + a2
		for item in a:
			print(item, end=' ')
		print('\n')
	else:
		print('NO')


for i in range(int(input())):
	num = int(input())
	if num % 4 == 0:
		arr = [i for i in range(2, num + 1, 2)]
		arr2 = [arr[i] - 1 for i in range(len(arr) - 1)]
		ans = [str(i) for i in arr + arr2 + [arr[-1] + len(arr2)]]
		print('YES')
		print(' '.join(ans))
	else:
		print('NO')


count = int(input())
while count > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		sEven = 0
		sOdd = 0
		array = [0] * (n + 1)
		for x in range(1, n // 2 + 1):
			array[n // 2 + x] = 2 * x - 1
			array[x] = 2 * x
			sEven += 2 * x
			sOdd += 2 * x - 1
		array[n] += sEven - sOdd
		print('YES')
		for x in range(1, n + 1):
			print(str(array[x]) + ' ')
	count = count - 1


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		flag = True
		a = []
		b = []
		if n // 2 % 2 != 0:
			flag = False
		else:
			tmp = 1
			for i in range(n // 2):
				a.append(tmp + 1)
				b.append(tmp)
				tmp += 2
			(sum_a, sum_b) = (sum(a), sum(b))
			if sum_a > sum_b:
				if (sum_a - sum_b) % 2 == 0:
					b[-1] += sum_a - sum_b
				else:
					flag = False
			elif sum_b > sum_a:
				if (sum_b - sum_a) % 2 == 0:
					a[-1] += sum_b - sum_a
				else:
					flag = False
		if flag:
			print('YES')
			print(*a, *b, sep=' ')
		else:
			print('NO')
main()


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	left = []
	right = []
	last = -1
	for i in range(n // 4):
		l = last + 2
		r = last + 6
		right.append(l + 1)
		right.append(r - 1)
		left.append(l)
		left.append(r)
		last = r
	print('YES')
	print(*right + left)


t = int(input())
for i in range(t):
	l = []
	l1 = []
	n = int(input())
	x = n // 2
	if x % 2 == 0:
		p = 2
		r = 1
		for j in range(x):
			l.append(p)
			p += 2
		for j in range(x - 1):
			l1.append(r)
			r += 2
		l1.append(sum(l) - sum(l1))
		print('YES')
		l = l + l1
		for j in l:
			print(j, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ones = [0] * (2 * k + 4)
	zeros = [0] * (2 * k + 4)
	for i in range(n // 2):
		x = l[i]
		y = l[n - i - 1]
		if x > y:
			(x, y) = (y, x)
		zeros[x + y] += 1
		ones[x + 1] += 1
		ones[y + k + 1] -= 1
	for i in range(1, 2 * k + 4):
		ones[i] += ones[i - 1]
	ans = 1000000
	for i in range(1, 2 * k + 4):
		res = ones[i] - zeros[i] + max(0, 2 * (n // 2 - ones[i]))
		ans = min(ans, res)
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n >= 4:
		(result, tab1, tab2) = ([], [2, 4], [1, 5])
		pos = 0
		while len(tab1) != n / 2:
			tab1.append(tab1[pos] + 6)
			tab2.append(tab2[pos] + 6)
			pos += 1
		if sum(tab1) == sum(tab2):
			print('YES')
			anwser = tab1 + tab2
			print(' '.join(map(str, anwser)))
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		end = []
		for j in range(1, n // 4 + 1):
			print(j * 8, j * 8 + 2, end=' ')
			end.extend([j * 8 - 1, j * 8 + 3])
		print(*end)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		even = [i for i in range(2, n + 1, 2)]
		odd = [i for i in range(1, n - 2, 2)]
		arr = even + odd + [sum(even) - sum(odd)]
		print(*arr)


for _ in range(int(input())):
	n = int(input())
	pivot = n // 2
	if pivot % 2 == 1:
		print('NO')
	else:
		print('YES')
		even_sum = pivot * (pivot + 1)
		for i in range(1, pivot + 1):
			print(2 * i, end=' ')
		odd_sum = (pivot - 1) ** 2
		for i in range(1, pivot):
			print(2 * i - 1, end=' ')
		print(even_sum - odd_sum)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		arr = []
		summ = 0
		i = 2
		j = 0
		while j < n // 2:
			arr.append(i)
			summ = summ + i
			i += 2
			j += 1
		if (n // 2) ** 2 == summ:
			i = 1
			j = 0
			while j < n // 2:
				arr.append(i)
				i += 2
				j += 1
		else:
			diff = summ - (n // 2) ** 2
			i = 1
			j = 1
			while j < n // 2:
				arr.append(i)
				i += 2
				j += 1
			diff = diff + i
			arr.append(diff)
		print('YES')
		for i in arr:
			print(i, end=' ')
		print()


def run():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 4:
			print('NO')
		else:
			print('YES')
			for j in range(n // 2):
				print((j + 1) * 4, end=' ')
			for j in range(n // 2):
				print((j + 1) * 4 + (1 if j % 2 else -1), end=' ')
			print()
run()


for t in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		li = [0] * n
		prev = -2
		for i in range(0, n // 2):
			if i % 2 == 0:
				li[i] = prev + 4
			else:
				li[i] = prev + 2
			prev = li[i]
		counter = 0
		for i in range(n // 2, n):
			if i % 2 == 0:
				li[i] = li[counter] - 1
			else:
				li[i] = li[counter] + 1
			counter += 1
		print('YES')
		for i in li:
			print(i, end=' ')
		print()


t = int(input())
for case in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	res = []
	for num in range(0, n):
		if num % 2 == 0:
			res.append(num + 2)
	for num in range(0, n):
		if num % 2 != 0:
			res.append(num + 2)
	res[n // 2 - 1] += n // 2
	print(*res)


a = int(input())
d = [0] * a
for i in range(0, a):
	b = int(input())
	d[i] = b
for i in range(0, a):
	m = 0
	l = 0
	f = [0] * d[i]
	if d[i] % 2 == 0:
		for i2 in range(1, d[i] // 2 + 1):
			f[i2 - 1] = i2 * 2
			m += i2 * 2
			l += i2 * 2 - 1
			f[i2 - 1 + d[i] // 2] = i2 * 2 - 1
		if abs(m - l) % 2 == 0:
			if m > l:
				f[d[i] - 1] = f[d[i] - 1] + m - l
			else:
				f[d[i] // 2 - 1] = f[d[i] // 2 - 1] + l - m
			print('YES')
			print(*f)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = n // 2
	if s % 2 != 0:
		print('NO')
	else:
		a = []
		for i in range(1, s + 1):
			x = 2 * i
			a.append(x)
		sum1 = sum(a)
		c = 0
		for j in range(1, s):
			x1 = 2 * j - 1
			a.append(x1)
			c = c + x1
		sum2 = sum1 - c
		a.append(sum2)
		print('YES')
		print(*a)


t = int(input())
for k in range(t):
	n = int(input())
	if n % 4 == 0:
		res = list()
		for i in range(n // 2):
			res.append((i + 1) * 2)
		last_num = 1
		i = 0
		sc = int((1 + n / 2) * n / 2)
		s = 0
		for i in range(n // 2 - 1):
			res.append(1 + i * 2)
			s += 1 + i * 2
		res.append(sc - s)
		print('YES')
		print(' '.join(map(str, res)))
	else:
		print('NO')


tests_num = int(input())
tests = [int(input()) for x in range(tests_num)]
for test in tests:
	if test % 4 != 0:
		print('NO')
	else:
		print('YES')
		part_size = int(test / 2)
		res = []
		even = 2
		odd = 1
		for n in range(part_size):
			res.append(even)
			even += 2
		for n in range(part_size - 1):
			res.append(odd)
			odd += 2
		res.append(odd + part_size)
		string = ''
		for n in res:
			string += str(n) + ' '
		string = string[:-1:1]
		print(string)


t = int(input())
for test in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	else:
		a = []
		total = int(n / 2)
		total = total * (total + 1)
		e = 2
		o = 1
		for i in range(int(n / 2)):
			a.append(e)
			e += 2
		ototal = 0
		for i in range(int(n / 2 - 1)):
			a.append(o)
			ototal += o
			o += 2
		a.append(total - ototal)
		if a[-1] % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(*a)


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		k = []
		for i in range(2, n + 1, 2):
			k.append(i)
		s = sum(k)
		v = []
		for i in range(1, n - 1, 2):
			v.append(i)
		v.append(s - sum(v))
		print(*k, end=' ')
		print(*v)


for _ in range(int(input())):
	a = int(input())
	if a % 4 != 0:
		print('NO')
		continue
	else:
		n = int(a / 2)
		x = [i * 2 for i in range(1, n + 1)]
		y = [i * 2 - 1 for i in range(1, n)]
		print('YES')
		print(' '.join([str(i) for i in x + y + [a - 1 + n]]))


t = int(input())
for pp in range(0, t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		even = []
		odd = []
		base = 10000000
		signeven = 1
		signodd = 1
		evenstart = 0
		oddstart = 1
		for i in range(0, n):
			if i % 2 == 0:
				if signeven == 1:
					even.append(base + evenstart)
					evenstart = evenstart + 2
					signeven = -1
				else:
					even.append(base - evenstart)
					evenstart = evenstart + 2
					signeven = 1
			elif signodd == 1:
				odd.append(base + oddstart)
				oddstart = oddstart + 2
				signodd = -1
			else:
				odd.append(base - oddstart)
				oddstart = oddstart + 2
				signodd = 1
		for ele in even:
			print(ele, end=' ')
		for ele in odd:
			if ele == odd[int(n / 2) - 1]:
				print(ele)
			else:
				print(ele, end=' ')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		length = n // 2
		res = []
		for i in range(length):
			res.append(2 * i + 2)
		for i in range(length // 2):
			res.append(2 * i + 1)
		for i in range(length // 2, length):
			res.append(2 * i + 3)
		print(' '.join(map(str, res)))


T = int(input())
for _ in range(T):
	n = int(input())
	even = []
	ele = 0
	sumeven = 0
	sumodd = 0
	for i in range(n // 2):
		ele += 2
		even.append(ele)
	sumeven = sum(even)
	ele = -1
	for i in range(n // 2, n - 1, 1):
		ele += 2
		even.append(ele)
	sumodd = sum(even[n // 2:])
	if n % 4 == 0:
		print('YES')
		even1 = ' '.join([str(elem) for elem in even])
		even1 = even1 + ' ' + str(sumeven - sumodd)
		print(even1)
	else:
		print('NO')


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

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

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		if n // 2 & 1 == 1:
			print('NO')
		else:
			e = deque([])
			o = deque([])
			x = 2
			for i in range(n // 2):
				e.append(x)
				x += 2
			x = 1
			for i in range(n // 2 - 1):
				o.append(x)
				x += 2
			o.append(x + n // 2)
			e = e + o
			print('YES')
			print(*e)
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()


t = int(input())

def main():
	n = int(input())
	if n % 2 or int(n / 2) % 2 or n < 3:
		return 'NO'
	evens = list(range(2, n + 1, 2))
	m = n / 2 - 1
	odds = [e - 1 for e in evens[:-1]]
	odds.append(int(m + evens[-1]))
	return 'YES\n' + ' '.join([str(x) for x in evens + odds])
for _ in range(t):
	print(main())


t = int(input())
for case in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		num = 2
		for i in range(n // 2):
			print(num, end=' ')
			num += 2
		num = 1
		for i in range(n // 2, 3 * n // 4):
			print(num, end=' ')
			num += 2
		num += 2
		for i in range(3 * n // 4, n):
			print(num, end=' ')
			num += 2
		print('\n')


def test_b():
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		(sum_odd, sum_even) = (0, 0)
		for i in range(2, n + 1, 2):
			sum_even += i
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			sum_odd += i
			print(i, end=' ')
		print(sum_even - sum_odd)
t = int(input())
for _ in range(t):
	test_b()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [0] * int(n / 2)
	b = []
	if int(n / 2) % 2 != 0:
		print('NO')
		continue
	x = 2
	for i in range(int(n / 2)):
		a[i] = x
		x = x + 2
	for j in range(len(a) - 1):
		b.append(a[j] - 1)
	b.append(a[-1] + len(b))
	print('YES')
	print(' '.join(map(str, a)), end=' ')
	print(' '.join(map(str, b)))


def solve():
	n = int(input())
	lis = []
	s = 0
	elem = 2
	if n % 4 == 0:
		print('YES')
		for i in range(n // 2):
			lis.append(elem)
			s += elem
			elem += 2
		elem = 1
		for i in range(n // 2 - 1):
			lis.append(elem)
			s -= elem
			elem += 2
		lis.append(s)
		print(*lis)
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


tc = int(input())
for _ in range(tc):
	(n, k) = map(int, input().split())
	a = [0] + list(map(int, input().split()))
	add = (2 * k + 1) * [0]
	l = 1
	r = n
	while l < r:
		(x, y) = (min(a[l], a[r]), max(a[l], a[r]))
		add[0] += 2
		add[x] -= 1
		add[x + y - 1] -= 1
		add[x + y] += 1
		add[y + k] += 1
		add[2 * k] -= 2
		l += 1
		r -= 1
	cur = add[0]
	ans = n
	for i in range(1, len(add)):
		ans = min(ans, cur)
		cur += add[i]
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		it = n // 2
		even = 2
		odd = 1
		ans = []
		for i in range(it):
			ans.append(even)
			even += 2
		it = n // 2
		for j in range(it):
			ans.append(odd)
			odd += 2
		ans[-1] += n // 2
		print(' '.join(map(str, ans)))
	else:
		print('NO')


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ev = list(range(2, n + 1, 2))
		od = list(range(1, n + 1, 2))
		od[-1] = sum(ev) - sum(od[:-1])
		ans = ev + od
		print('YES')
		print(*ans)
t = int(input())
while t > 0:
	solve()
	t -= 1


import sys
readline = sys.stdin.readline
write = sys.stdin.write
for _ in range(int(readline())):
	n = int(readline()) // 2
	if n & 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n + 1):
		print('{0} '.format(2 * i), end='')
	for i in range(1, n):
		print('{0} '.format(2 * i - 1), end='')
	print(3 * n - 1)


t = int(input())
for case in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(int(n / 2)):
			print(int(2 * (i + 1)), end=' ')
		for i in range(int(n / 2 - 1)):
			print(int(2 * i + 1), end=' ')
		print(int(n + n / 2 - 1))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		o = []
		e = []
		for i in range(1, n + 1):
			if i % 2 != 0:
				if i == n - 1:
					pass
				else:
					o.append(i)
			else:
				e.append(i)
		s = sum(e) - sum(o)
		o.append(s)
		print('YES')
		print(*e + o)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		f = [i for i in range(2, n + 1, 2)]
		s = [i * 2 + 1 for i in range(int(n / 2) - 1)] + [int(n * 1.5 - 1)]
		f.extend(s)
		print('YES')
		print(' '.join(map(str, f)))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		m = n // 2
		even = list(range(2, m * 2 + 2, 2))
		odd = list(range(1, m * 2 - 1, 2))
		odd.append(sum(even) - sum(odd))
		lst = even + odd
		print(*lst)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		arr = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				arr.append(i)
		av = sum(arr) // len(arr)
		for j in range(1, n + 2, 2):
			if j != av:
				arr.append(j)
		print(*arr)
	else:
		print('NO')


x = int(input())
for num in range(x):
	y = int(input())
	if y % 4 == 0:
		print('YES')
		for num1 in range(int(y / 2)):
			num1 += 1
			print(num1 * 2, end=' ')
		for num1 in range(int(y / 2)):
			num1 += 1
			if num1 <= y / 4:
				print(num1 * 2 - 1, end=' ')
			else:
				print(num1 * 2 + 1, end=' ')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		o = []
		e = []
		s = 0
		so = 0
		for i in range(n // 2):
			e.append(2 * i + 2)
			o.append(2 * i + 1)
			s += e[i]
			so += o[i]
		e += o
		so -= o[-1]
		e[-1] = s - so
		for i in e:
			print(i, end=' ')
		print()
	t -= 1


t = int(input())
while t != 0:
	t = t - 1
	evenlist = []
	oddlist = []
	flist = []
	n = int(input())
	m = int(n / 2)
	if m % 2 == 0:
		for i in range(1, m + 1):
			evenlist.append(2 * i)
			oddlist.append(2 * i - 1)
		oddlist[m - 1] = evenlist[m - 1] + m - 1
		for i in evenlist:
			flist.append(i)
		for i in oddlist:
			flist.append(i)
		string = ''
		for i in flist:
			string += str(i) + ' '
		print('YES')
		print(string)
	elif m % 2 != 0:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = []
		b = []
		x = []
		i = 1
		s1 = 0
		s2 = 0
		for k in range(n):
			if i % 2 == 0:
				a.append(str(i))
				s1 += k
			else:
				if i == n - 1:
					i = s1 + n - s2
				b.append(str(i))
				s2 += k
			i = k + 2
		print('YES')
		x = a + b
		print(' '.join(x))


t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr_0 = [0 for i in range(2 * k + 1)]
	arr_1 = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		min_no = min(arr[i], arr[n - i - 1])
		max_no = max(arr[i], arr[n - i - 1])
		arr_0[min_no + max_no] += 1
		l_ind = min_no + 1
		r_ind = max_no + k
		arr_1[l_ind] += 1
		arr_1[r_ind + 1] -= 1
	for i in range(2, 2 * k + 2):
		arr_1[i] += arr_1[i - 1]
	ans = 10000000
	for i in range(2, 2 * k + 1):
		cur_ans = arr_1[i] - arr_0[i] + 2 * (n // 2 - arr_1[i])
		if cur_ans < ans:
			ans = cur_ans
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('No')
	else:
		print('YES')
		x = 2
		s1 = 0
		s2 = 0
		for j in range(0, n // 2):
			print(x, end=' ')
			s1 += x
			x += 2
		x = 1
		for j in range(0, n // 2 - 1):
			print(x, end=' ')
			s2 += x
			x += 2
		print(s1 - s2)


for _ in range(int(input())):
	n = int(input())
	res = []
	if n // 2 % 2:
		print('NO')
		continue
	(res[:n // 2], res[n // 2:]) = ([2 * x + 2 for x in range(n // 2)], [2 * x + 1 for x in range(n // 2)])
	req_sum = n // 2 * (n // 2 + 1)
	res[-1] = req_sum - sum(res[n // 2:-1])
	print('YES')
	print(*res)


for _ in range(int(input())):
	n = int(input())
	k = []
	p = []
	q = []
	for i in range(1, n + 1):
		k.append(i)
	for j in k:
		if j % 2 == 0:
			p.append(j)
		else:
			q.append(j)
	sum1 = sum(p)
	sum2 = sum(q)
	diff = sum1 - sum2
	q[-1] = q[-1] + diff
	for num in q:
		p.append(num)
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		print(*p)


def task(n, k, a):
	sums = {}
	maxk = k * 2 + 2
	mins = [0] * maxk
	maxs = [0] * maxk
	half = int(n / 2)
	for i in range(0, half):
		c = a[i]
		d = a[n - 1 - i]
		suma = c + d
		if not suma in sums:
			sums[suma] = 0
		sums[suma] += 1
		mins[min(c, d) + 1] += 1
		maxs[max(c, d) + k + 1] += 1
	value = 0
	best = half
	for i in range(0, maxk):
		value += mins[i] - maxs[i]
		if i in sums:
			one_swap = value - sums[i]
			two_swaps = half - value
			swaps = one_swap + 2 * two_swaps
			best = min(best, swaps)
	print(best)
t = int(input())
for i in range(0, t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	task(n, k, a)


t = int(input())
for _ in range(t):
	n = int(input())
	arrayeven = [i for i in range(2, n + 1, 2)]
	arraynoteven = [i for i in range(1, n, 2)]
	del arraynoteven[-1]
	SumEven = sum(arrayeven)
	SumNotEven = sum(arraynoteven)
	k = 1
	while SumEven != SumNotEven + k:
		if SumNotEven + k >= SumEven:
			print('NO')
			break
		k += 2
	else:
		arraynoteven.append(k)
		print('YES')
		print(*arrayeven + arraynoteven)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 4 != 0:
		print('NO')
		continue
	print('YES')
	chet = [q for q in range(2, a + 1, 2)]
	nechet = [q for q in range(1, chet[-2], 2)]
	last = sum(chet) - sum(nechet)
	nechet.append(last)
	print(' '.join(map(str, chet + nechet)))


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

def BalancedArray(n):
	temp = 2
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print(temp, end=' ')
			temp += 2
		temp = 1
		for i in range(n // 2 - 1):
			print(temp, end=' ')
			temp += 2
		print(temp + n // 2)
main()


for t in range(int(input())):
	n = int(input())
	a = []
	r = n // 2
	if r % 2 != 0:
		print('NO')
	else:
		s = 0
		x = 2
		for i in range(r):
			a.append(x)
			s += x
			x += 2
		y = 1
		z = 0
		for i in range(r - 1):
			a.append(y)
			z += y
			y += 2
		h = s - z
		a.append(h)
		print('YES')
		print(*a, sep=' ')


n = int(input())
for _ in range(n):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		c = [2 * int(i) for i in range(1, a // 2 + 1)]
		cs = sum(c)
		k = 1
		s = 1
		while k < a // 2:
			cs -= s
			k += 1
			c.append(s)
			s += 2
		print(*c, cs)


def solve():
	n = int(input())
	n = n // 2
	ans = []
	s = 0
	o = 1
	e = 2
	if n % 2 != 0:
		print('NO')
	else:
		for i in range(n):
			ans.append(e)
			s += e
			e += 2
		for i in range(n - 1):
			ans.append(o)
			s -= o
			o += 2
		ans.append(s)
		print('YES')
		print(' '.join(map(str, ans)))

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


import math
for _ in range(int(input())):
	n = int(input())
	os = 0
	es = 0
	arr = [0] * n
	start = 2
	start1 = 0
	d = 0
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(n):
			if i < n // 2:
				arr[i] = start + i * 2
				es += arr[i]
			elif i != n - 1:
				arr[i] = arr[start1] - 1
				d += 1
				start1 += 1
			else:
				arr[n - 1] = arr[start1] + d
		for i in range(n):
			print(arr[i], end=' ')
	else:
		print('NO')
		continue


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l1 = []
		x = 0
		y = 1
		s = 0
		for i in range(0, int(n / 2)):
			l1.append((i + 1) * 2)
			x += (i + 1) * 2
		for j in range(0, int(n / 2) - 1):
			l1.append(y)
			s += y
			y += 2
		l1.append(x - s)
		print('YES')
		print(*l1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	zero = [0 for i in range(2 * k + 2)]
	ones = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		(x, y) = (a[i], a[n - i - 1])
		(x, y) = (min(x, y), max(x, y))
		zero[x + y] += 1
		ones[x + 1] += 1
		ones[y + k + 1] -= 1
	pref = [0 for i in range(2 * k + 2)]
	for i in range(1, len(pref)):
		pref[i] = pref[i - 1] + ones[i]
	ans = n + 1
	for i in range(0, 2 * k + 1):
		ans = min(ans, pref[i] - zero[i] + 2 * (n // 2 - pref[i]))
	print(ans)


def Un(a, b, n):
	return a + (n - 1) * b

def build_arr(n):
	last_even = Un(2, 2, n // 2)
	last_odd = Un(1, 2, n // 2 - 1)
	even_arr = [num for num in range(2, last_even + 1, 2)]
	odd_arr = [num for num in range(1, last_odd + 1, 2)]
	odd_arr.append(n // 2 - 1 + last_even)
	ans = even_arr + odd_arr
	return ans
t = int(input())
for tc in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		ans = build_arr(n)
		print(*ans)
	else:
		print('NO')


n = int(input())
for i in range(n):
	arrSize = int(input())
	ans = [None] * arrSize
	ansString = ''
	if arrSize // 2 % 2 == 0:
		for j in range(arrSize):
			if (j + 1) % 2 == 0:
				ans[j // 2] = j + 1
			elif j == arrSize - 2:
				ans[arrSize // 2 + j // 2] = arrSize + arrSize // 2 - 1
			else:
				ans[arrSize // 2 + j // 2] = j + 1
		for it in ans:
			ansString += str(it) + ' '
		print('YES')
		print(ansString)
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	p = n // 2
	ar = []
	sum1 = 0
	sum2 = 0
	if p % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			ar.append(i)
			sum1 += i
		for j in range(0, n // 2 - 1):
			f = ar[j] - 1
			ar.append(f)
			sum2 += f
		x = sum1 - sum2
		ar.append(x)
		print(*ar)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = [0 for i in range(n)]
		num = 2
		for i in range(n // 2):
			ans[i] = num
			num += 2
		for i in range(n // 4):
			ans[i + n // 2] = ans[i] - 1
			ans[i + n // 2 + n // 4] = ans[i + n // 4] + 1
		print(*ans, sep=' ')


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
fast_print = stdout.write
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	check_min = []
	check_max = []
	sums = {}
	for i in range(n // 2):
		check_min.append(min(ls[i], ls[n - i - 1]) + 1)
		check_max.append(max(ls[i], ls[n - i - 1]) + k)
		try:
			sums[ls[i] + ls[n - i - 1]] += 1
		except:
			sums[ls[i] + ls[n - i - 1]] = 1
	check_min.sort()
	check_max.sort()
	ans = n - 2
	for s in range(2, 2 * k + 1):
		fail1 = n // 2 - bisect_right(check_min, s)
		fail2 = bisect_left(check_max, s)
		cur_ans = n // 2 + fail1 + fail2
		try:
			cur_ans -= sums[s]
		except:
			pass
		ans = min(ans, cur_ans)
	fast_print(str(ans) + '\n')


n = int(input())
k = [0] * n
for i in range(n):
	k[i] = int(input())

def ope(a):
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		s = ''
		q = 2
		for i in range(a // 2):
			s += str(q)
			s += ' '
			q += 2
		q = 1
		for i in range(a // 2 - 1):
			s += str(q)
			s += ' '
			q += 2
		q += a // 2
		s += str(q)
		print(s)
for j in range(n):
	ope(k[j])


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	n = int(input().strip())
	ans = []
	if n // 2 % 2:
		print('NO')
		continue
	for i in range(1, n // 2 + 1):
		ans.append(2 * i)
	for i in range(1, n // 2 + 1):
		ans.append(2 * i - 1)
	ans[-1] += n // 2
	print('YES')
	print(*ans)


import math
t = int(input())
for q in range(0, t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(0, n // 2):
			a.append(2 * (i + 1))
		k = sum(a)
		for i in range(0, n // 2 - 1):
			a.append(2 * (i + 1) - 1)
		k1 = sum(a)
		a.append(k - (k1 - k))
		print(*a)


def solve(n):
	(ans, ndivided2) = ([], n // 2)
	for i in range(1, ndivided2 + 1):
		ans.append(2 * i)
	for i in range(1, ndivided2 + 1):
		ans.append(2 * i - 1)
	ans[n - 1] = ans[n - 1] + ndivided2
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
		continue
	print('YES')
	ans = solve(n)
	print(*ans, sep=' ')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	even = [0] * (n // 2)
	odd = [0] * (n // 2)
	for i in range(n // 2 - 1):
		even[i] = 2 * (i + 1)
		odd[i] = 2 * (i + 1) - 1
	temp = sum(even) - sum(odd)
	if n == 2:
		print('NO')
	elif temp % 2 == 0:
		print('NO')
	else:
		even[n // 2 - 1] = even[n // 2 - 2] + 2
		odd[n // 2 - 1] = even[n // 2 - 1] + temp
		print('YES')
		print(*even + odd)


t = int(input())
for z in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = n // 2
		l = []
		sum1 = 0
		sum2 = 0
		for i in range(1, k + 1):
			l.append(2 * i)
			sum1 += 2 * i
		for i in range(1, k):
			l.append(2 * i - 1)
			sum2 += 2 * i - 1
		l.append(sum1 - sum2)
		for i in l:
			print(i, end=' ')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	c = [0] * (2 * k + 2)
	for i in range(n // 2):
		x = a[i]
		y = a[n - i - 1]
		maxi = max(x, y) + k
		mini = min(x, y) + 1
		c[x + y] -= 1
		c[x + y + 1] += 1
		c[mini] += 1
		c[maxi + 1] -= 1
		c[2] += 2
		c[mini] -= 2
		c[maxi + 1] += 2
		c[2 * k + 1] -= 2
	ans = []
	cur = 0
	for i in range(2, 2 * k + 1):
		cur += c[i]
		ans.append(cur)
	print(min(ans))


t = int(input())
for test in range(t):
	n = int(input())
	array = []
	for i in range(1, n // 2 + 1):
		array.append(2 * i)
	for i in range(1, n // 2):
		array.append(2 * i - 1)
	num = sum(array[:n // 2]) - sum(array[n // 2:])
	if not num in array and num % 2 == 1:
		array.append(num)
		print('YES')
		for item in array:
			print(item, end=' ')
		print()
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		a = [0] * n
		sume = 0
		sumo = 0
		for i in range(n // 2):
			a[i] = 2 * (i + 1)
			sume += a[i]
		for i in range(n // 2, n - 1):
			a[i] = 2 * (i - n // 2) + 1
			sumo += a[i]
		a[n - 1] = sume - sumo
		for i in range(n):
			print(a[i], end=' ')
		print()
	else:
		print('NO')


for test in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		lst = []
		for no in range(int(n / 2)):
			lst.append(no * 2 + 2)
		s = len(lst)
		for no in range(s - 1):
			lst.append(lst[no] - 1)
		lst.append(lst[s - 1] + s - 1)
		print(*lst)


t = int(input())
for q in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
		for i in range(1, n // 2):
			print(i * 2 - 1, end=' ')
		s1 = n // 2 * (n // 2 + 1)
		s2 = (n // 2 - 1) ** 2
		print(s1 - s2)


from collections import defaultdict
from itertools import accumulate

def solve(a, n, k):
	pairs = [(min(x, y), max(x, y)) for (x, y) in zip(a[:n], a[::-1][:n])]
	one_change = [(x + 1, y + k) for (x, y) in pairs]
	changes = [0] * (2 * k + 2)
	for (a, b) in one_change:
		changes[a] += 1
		changes[b + 1] -= 1
	changes = list(accumulate(changes))
	for (x, y) in pairs:
		changes[x + y] += 1
	print(2 * n - max(changes[2:2 * k + 1]))
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	solve(a, n // 2, k)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	print('YES')
	for i in range(1, n // 2 + 1):
		print(i * 2, end=' ')
	for i in range(n // 2 - 1):
		print(i * 2 + 1, end=' ')
	print(2 * (n // 2) - 1 + n // 2)


t = int(input())
for _ in range(0, t):
	n = int(input())
	p = n // 2
	z = p % 2
	if n == 2:
		print('NO')
	elif z % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = 2
		d = 1
		sum = 0
		sum1 = 0
		for i in range(0, p):
			print(k, end=' ')
			sum1 = sum1 + k
			k = k + 2
		for i in range(0, p - 1):
			print(d, end=' ')
			sum = sum + d
			d = d + 2
		print(sum1 - sum)


n = int(input())
for _ in range(n):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		c = 0
		m = 0
		for i in range(2, n + 1, 2):
			l.append(i)
			c = c + 1
		for j in range(1, n - 1, 2):
			l.append(j)
			m = j
		l.append(m + c + 2)
		for h in l:
			print(h, end=' ')
		print()


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 math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

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

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

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')
from itertools import accumulate

def main():
	for _ in range(N()):
		(n, k) = RL()
		arr = RLL()
		res = [0] * (2 * k + 2)
		for i in range(n // 2):
			(f, s) = (arr[i], arr[n - i - 1])
			if f > s:
				(f, s) = (s, f)
			res[k + s + 1] += 1
			res[f + s] -= 1
			res[f + 1] -= 1
			res[f + s + 1] += 1
		for i in range(len(res) - 1):
			res[i + 1] += res[i]
		print(n + min(res))
main()


t = int(input())
for tt in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = []
		bns = []
		for i in range(2, n + 1, 2):
			ans.append(i)
			if i <= n // 2:
				bns.append(i - 1)
			else:
				bns.append(i + 1)
		for j in bns:
			ans.append(j)
		for i in ans:
			print(i, end=' ')
		print()


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
Ps = lambda x: stdout.write(str(x))
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())
MaxN = 1 << 60

def f(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 1
	return 0

def main():
	test = int(R())
	for t in range(test):
		n = int(R())
		A = []
		if n // 2 % 2 == 0:
			Pi('YES')
			for i in range(n // 2):
				A.append((i + 1) * 2)
			B = []
			for i in range(n // 2 - 1):
				B.append(i * 2 + 1)
			B.append(sum(A) - sum(B))
			for i in A:
				Ps(str(i) + ' ')
			for i in B:
				Ps(str(i) + ' ')
			Ps('\n')
		else:
			Pi('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	s = 0
	for i in range(2, n + 1, 2):
		print(i, ' ', sep='', end='')
		s += i
	s1 = 0
	for i in range(1, n - 2, 2):
		print(i, ' ', sep='', end='')
		s1 += i
	print(s - s1)


def check(n):
	arr1 = [i * 2 for i in range(1, n // 2 + 1)]
	arr2 = [i * 2 + 1 for i in range(0, n // 2 - 1)]
	sum1 = sum(arr1)
	sum2 = sum(arr2)
	arr2.append(sum1 - sum2)
	arr1.extend(arr2)
	return arr1
t = int(input())
while t:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		result = check(n)
		for i in result:
			print(i, end=' ')
		print()
	t -= 1


import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	n = int(input())
	k = n // 2
	ans = [0] * n
	if n % 4 != 0:
		print('NO')
		continue
	for i in range(n):
		if i < k:
			ans[i] = 2 * (i + 1)
		elif i < n - 1:
			ans[i] = 2 * (i - k) + 1
		else:
			ans[i] = sum(ans[:k]) - sum(ans[k:-1])
	print('YES')
	print(*ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	if n % 4 == 0:
		print('YES')
		for i in range(2, n + 1):
			if i % 2 == 0:
				l.append(i)
		c = 0
		for i in range(1, n):
			if i % 2 != 0:
				l.append(i)
				c += 1
				if c == n // 2 - 1:
					break
		s1 = sum(l[0:n // 2])
		s2 = sum(l[n // 2:])
		l.append(s1 - s2)
		print(*l)
	else:
		print('NO')


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	for _ in range(int(input())):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			arr = [(i + 1) * 4 for i in range(n // 2)]
			last = []
			for (i, v) in enumerate(arr):
				if i % 2 == 0:
					last.append(v + 1)
				else:
					last.append(v - 1)
			print(*arr, *last)
solution()


for t in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO')
	elif n // 2 % 2 == 0:
		print('YES')
		c = 2
		f = 0
		for i in range(n // 2):
			print(c, end=' ')
			f += c
			c += 2
		c = 1
		g = 0
		for i in range(n // 2 - 1):
			print(c, end=' ')
			g += c
			c += 2
		print(f - g)
	else:
		print('NO')


def solve(a, n, k):
	cnt = [0] * (2 * k + 1)
	one = [0] * (2 * k + 1)
	for i in range(n // 2):
		s = a[i] + a[n - i - 1]
		minVal = min(a[i], a[n - i - 1])
		maxVal = max(a[i], a[n - i - 1])
		minSum = minVal + 1
		maxSum = maxVal + k
		if maxSum <= 2 * k - 1:
			one[maxSum + 1] -= 1
		one[minSum] += 1
		cnt[s] += 1
	for i in range(3, 2 * k + 1):
		one[i] += one[i - 1]
	ans = 200000.0
	for i in range(2, 2 * k + 1):
		tmp = one[i] - cnt[i] + 2 * (n // 2 - one[i])
		if tmp < ans:
			ans = tmp
	print(ans)

def main():
	t = int(input())
	for i in range(t):
		(n, k) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		solve(a, n, k)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2
	if half % 2 != 0:
		print('NO')
	else:
		arr = []
		start = 0
		count = 0
		print('YES')
		for i in range(n // 2):
			arr.append(start + 2)
			count += start + 2
			start += 2
		start1 = -1
		for i in range(half - 1):
			arr.append(start1 + 2)
			count -= start1 + 2
			start1 += 2
		arr.append(count)
		print(*arr)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	else:
		x = n // 2
		es = x * (x + 1)
		os = pow(x - 1, 2)
		if es - os & 1 != 1:
			print('NO')
		else:
			print('YES')
			e = 2
			for j in range(x):
				print(e, end=' ')
				e += 2
			o = 1
			for j in range(x - 1):
				print(o, end=' ')
				o += 2
			print(es - os)


for _ in range(int(input())):
	t = int(input())
	k = t // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		ll = []
		for i in range(1, k + 1):
			l.append(2 * i)
		s = sum(l)
		for j in range(1, k):
			o = 2 * j - 1
			ll.append(o)
		a = s - sum(ll)
		ll.append(a)
		k = l + ll
		print(*k)


t = int(input())
for i in range(t):
	n = int(input())
	n = int(n / 2)
	array = []
	if n % 2 != 0 or n == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, n + 1, 1):
			array.append(j * 2)
		for k in range(1, n + 1, 1):
			array.append(k * 2 - 1)
		array[n * 2 - 1] += n
		print(' '.join((str(e) for e in array)))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
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, k) = LI()
		a = LI()
		r = [0] * (k * 2 + 3)
		for i in range(n // 2):
			(b, c) = (a[i], a[n - i - 1])
			if b > c:
				(b, c) = (c, b)
			r[2] += 2
			r[b + 1] -= 1
			r[b + c] -= 1
			r[b + c + 1] += 1
			r[k + c + 1] += 1
		for i in range(3, k * 2 + 1):
			r[i] += r[i - 1]
		rr.append(min(r[2:k * 2 + 1]))
	return JA(rr, '\n')
print(main())


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	elif n % 4 != 0:
		print('NO')
	else:
		sum1 = sum2 = 0
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			sum1 += i
		for j in range(1, n - 2, 2):
			print(j, end=' ')
			sum2 += j
		print(sum1 - sum2)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		(even, odd) = ([], [])
		s = 0
		for _ in range(x):
			s += 2
			even.append(s)
			odd.append(s - 1)
		odd[-1] += x
		print('YES')
		print(*even + odd)


t = int(input(''))
for i in range(t):
	x = int(input(''))
	if x % 4 != 0:
		print('NO')
	else:
		print('YES')
		list1 = []
		for i in range(1, int(x / 2) + 1):
			print(i * 2, end='')
			print(' ', end='')
		for i in range(0, int(x / 2) - 1):
			print(i * 2 + 1, end='')
			print(' ', end='')
		print(int(x / 2) * 2 - 1 + int(x / 2))


from math import *
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		summ = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			summ += i
		summ2 = 0
		for i in range(1, n - 1, 2):
			print(i, end=' ')
			summ2 += i
		print(summ - summ2)


cas = int(input())
for _ in range(cas):
	n = int(input())
	print('YES' if n % 4 == 0 else 'NO')
	if n % 4 == 0:
		x = [4 * i + 2 for i in range(n // 2)]
		for i in range(n // 2):
			x.append(4 * i + 3 if i % 2 == 0 else 4 * i + 1)
		print(' '.join([str(i) for i in x]))


nums = int(input())
for _ in range(nums):
	n = int(input())
	if n % 4 != 0 and n % 2 == 0:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		arr1 = [2 * (m + 1) for m in range(n // 2)]
		arr2 = [2 * m + 1 for m in range(n // 2 - 1)]
		x = sum(arr1) - sum(arr2)
		arr = arr1 + arr2
		arr.append(x)
		print(*arr)


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = []
		k = 2
		s = 0
		for i in range(n // 2):
			a.append(k)
			k += 2
			s += 1
		p = 1
		o = a[len(a) - 1]
		for i in range(n // 2 - 1):
			a.append(p)
			p += 2
		d = o + (s - 1)
		a.append(d)
		print('YES')
		print(*a)


for _ in range(int(input())):
	N = int(input())
	if not N // 2 % 2:
		print('Yes')
		for i in range(1, N // 2 + 1, 1):
			print(2 * i, end=' ')
		for i in range(1, N // 2, 1):
			print(2 * i - 1, end=' ')
		print(N + N // 2 - 1)
	else:
		print('No')


t = int(input())
for T in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	ans = []
	(even, odd) = (2, 1)
	(E, O) = (even, odd)
	while len(ans) < n // 2:
		ans.append(even)
		even += 2
		E += even
	while len(ans) < n:
		ans.append(odd)
		odd += 2
		O += odd
	ans[-1] += E - O - 1
	print('YES')
	print(*ans)


import sys
input = sys.stdin.readline
import heapq
import copy
import math

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

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

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

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

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		[n, k] = inlt()
		a = inlt()
		mini = [0 for i in range(2 * k + 1)]
		maxi = [0 for i in range(2 * k + 1)]
		freq = [0 for i in range(2 * k + 1)]
		for i in range(int(n / 2)):
			mini[min(a[i], a[n - i - 1]) + 1] += 1
			maxi[max(a[i], a[n - i - 1]) + k] += 1
			freq[a[i] + a[n - i - 1]] += 1
		for i in range(1, 2 * k + 1):
			maxi[i] = maxi[i] + maxi[i - 1]
		for i in range(2 * k - 1, -1, -1):
			mini[i] = mini[i + 1] + mini[i]
		mini.append(0)
		ans = sys.maxsize
		for i in range(1, 2 * k + 1):
			ans = min(ans, int(n / 2) - freq[i] + mini[i + 1] + maxi[i - 1])
		print(ans)
	return 0
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		num_list = []
		for i in range(int(n / 2)):
			num_list.append(2 * (i + 1))
		last = num_list[-1] + (n / 2 - 1)
		i = 1
		for _ in range(int(n / 2) - 1):
			num_list.append(i)
			i += 2
		num_list.append(int(last))
		print(*num_list)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	a = []
	print('YES')
	sum = 0
	for j in range(int(n / 2)):
		a.append(2 * (j + 1))
		sum += 2 * (j + 1)
	for k in range(int(n / 2 - 1)):
		a.append(2 * (k + 1) - 1)
		sum -= 2 * (k + 1) - 1
	a.append(sum)
	[print(x, end=' ') for x in a]


def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		if n % 4 > 0:
			print('NO')
			continue
		print('YES')
		for i in range(n // 2):
			print(2 * (i + 1), end=' ')
		for i in range(n // 2 - 1):
			print(2 * (i + 1) - 1, end=' ')
		print(n - 1 + n // 2)
main()


t = int(input())
for i in range(t):
	n = int(input())
	array_eve = []
	array_odd = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k_eve = 2
		k_odd = 1
		flag = 0
		for j in range(n // 2):
			array_eve.append(k_eve)
			if j == -1 + n // 2:
				array_odd.append(sum(array_eve) - sum(array_odd))
			else:
				array_odd.append(k_odd)
			k_eve += 2
			k_odd += 2
		for j in range(n):
			if j < n // 2:
				print(array_eve[j], end=' ')
			elif j != n - 1:
				print(array_odd[j - n // 2], end=' ')
			else:
				print(array_odd[j - n // 2])


x = int(input())
for _ in range(x):
	y = int(input())
	arr = [0] * y
	add = 2
	if y < 4 or y // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		add = 2
		for i in range(0, y // 2):
			if i == y // 2 - 1:
				print(f'{add + len(arr) // 2} ', end='')
			else:
				print(f'{add} ', end='')
				add += 2
		add = 3
		for i in range(y // 2, y):
			print(f'{add} ', end='')
			add += 2
		print()


from collections import defaultdict
n = int(input())
for i in range(n):
	(m, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	h = defaultdict(int)
	pair = []
	(s, e) = (0, len(nums) - 1)
	while s < e:
		h[nums[s] + nums[e]] += 1
		pair.append((min(nums[s], nums[e]), max(nums[s], nums[e])))
		s += 1
		e -= 1
	p = [0] * (2 * k + 1)
	for (s, e) in pair:
		new_range = (s + 1, e + k)
		p[new_range[0]] += 1
		if new_range[1] + 1 < len(p):
			p[new_range[1] + 1] -= 1
	for i in range(1, len(p)):
		p[i] += p[i - 1]
	final = []
	for i in range(2, 2 * k + 1):
		changes = len(pair)
		(zero, one, two) = (0, 0, 0)
		if i in h:
			zero += h[i]
			changes -= zero
		if changes:
			one = p[i] - zero
			changes -= one
		if changes:
			two = changes
		final.append(2 * two + one)
	print(min(final))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		e = [2]
		o = [1]
		so = 1
		se = 2
		for i in range(n // 2 - 2):
			e.append(e[-1] + 2)
			se += e[-1]
			o.append(o[-1] + 2)
			so += o[-1]
		e.append(e[-1] + 2)
		se += e[-1]
		o.append(se - so)
		l = e + o
		for i in range(n):
			print(l[i], end=' ')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	m = n // 2
	arr = [0] + arr
	a = [0] * (2 * k + 1)
	b = [0] * (2 * k + 1)
	c = [0] * (2 * k + 1)
	for i in range(1, m + 1):
		x = arr[i]
		y = arr[n - i + 1]
		a[min(x, y) + 1] += 1
		b[x + y] += 1
		c[max(x, y) + k] += 1
	cum_a = [0]
	cum_b = [0]
	cum_c = [0]
	for i in range(1, 2 * k + 1):
		cum_a.append(cum_a[-1] + a[i])
		cum_b.append(cum_b[-1] + b[i])
		cum_c.append(cum_c[-1] + c[i])
	sol = []
	for i in range(1, 2 * k + 1):
		s1 = cum_a[-1] - cum_a[i]
		s2 = cum_a[i]
		s3 = cum_b[i] - cum_b[i - 1]
		s4 = cum_c[i - 1]
		sol.append(2 * s1 + s2 - s3 + s4)
	print(min(sol))


t = int(input())

def find(n):
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				arr.append(i)
		for i in range(n - 1):
			if i % 2 != 0:
				arr.append(i)
		arr.append(n + n // 2 - 1)
		print(*arr)
	else:
		print('NO')
inpt = []
for i in range(t):
	inpt.append(int(input()))
for i in inpt:
	n = i
	if n % 2 == 0:
		arr = []
		find(n)


n = int(input())
for i in range(n):
	n = int(input())
	l = []
	l1 = []
	(s, s1) = (0, 0)
	for i in range(1, n + 2):
		if i % 2 == 0:
			s = s + i
			l.append(i)
		elif i % 2 == 1:
			s1 = s1 + i
			l1.append(i)
	(x, y) = (len(l), len(l1))
	(f, f1) = (0, 0)
	if x >= y:
		for i in l:
			if s - i == s1:
				l.remove(i)
				f = 1
				break
		if f == 1:
			print('YES')
			l.extend(l1)
			print(*l)
		else:
			print('NO')
	if x <= y:
		for i in l1:
			if s1 - i == s:
				l1.remove(i)
				f1 = 1
				break
		if f1 == 1:
			print('YES')
			l.extend(l1)
			print(*l)
		else:
			print('NO')


test_case = int(input())
array = []
even_sum = 0
odd_sum = -1
while test_case > 0:
	length = int(input())
	even_half = length // 2
	for x in range(even_half):
		even_sum = even_sum + 2
		array.append(even_sum)
	for y in range(even_half - 1):
		odd_sum = odd_sum + 2
		array.append(odd_sum)
	remain = sum(array[even_half:])
	if (sum(array[0:even_half]) - remain) % 2 != 0:
		array.append(sum(array[0:even_half]) - remain)
		print('YES')
		print(*array, sep=' ')
	else:
		print('NO')
	test_case -= 1
	even_sum = 0
	odd_sum = -1
	array = []


T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	cnt = [0] * (2 * k + 2)
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		cnt[l[i] + l[n - 1 - i]] += 1
		pref[min(l[i], l[n - 1 - i]) + 1] += 1
		pref[max(l[i], l[n - 1 - i]) + k + 1] -= 1
	for i in range(1, 2 * k + 2):
		pref[i] = pref[i] + pref[i - 1]
	ans = []
	for i in range(2 * k + 2):
		ans.append(pref[i] - cnt[i] + abs(n // 2 - pref[i]) * 2)
	print(min(ans[2:]))


import math
from collections import Counter
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()
	if n % 4:
		print('NO')
		continue
	print('YES')
	for i in range(2, n + 1, 2):
		print(i, end=' ')
	for i in range(1, n - 1, 2):
		print(i, end=' ')
	print(n + n // 2 - 1)


from __future__ import division, print_function
import os
import 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 main():
	t = inp()
	for i in range(t):
		solve()

def solve():
	n = inp()
	part = n // 2
	if part % 2 == 1:
		print('NO')
		return
	print('YES')
	even = 2
	res = []
	for i in range(part // 2):
		res.append(even)
		even += 4
		res.append(even)
		even += 2
	odd = 3
	for i in range(part // 2):
		res.append(odd)
		odd += 2
		res.append(odd)
		odd += 4
	print(*res)
BUFSIZE = 8192

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())

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())
while t > 0:
	t = t - 1
	n = int(input())
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = 2
		b = 1
		c = 0
		d = 0
		for i in range(0, n, 2):
			print(a, end=' ')
			c = c + a
			a = a + 2
		for i in range(0, n - 2, 2):
			print(b, end=' ')
			c = c - b
			b = b + 2
		print(c)


t = int(input())
array = []
for i in range(t):
	n = int(input())
	array.append(n)

def balanced(n):
	arr = []
	if n % 4 != 0:
		print('\nNO')
	else:
		n_ = int(n / 2)
		print('YES')
		for i in range(2, 2 * n_ + 1, 2):
			arr.append(i)
		for i in range(1, 2 * n_ - 2, 2):
			arr.append(i)
		arr.append(n_ * (n_ + 1) - (n_ - 1) ** 2)
		for i in arr:
			print(i, end=' ')
for num in array:
	balanced(num)


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		arr = []
		even = 2
		sm = 0
		while even <= n:
			arr.append(even)
			sm += even
			even += 2
		even = 1
		while even < n - 1:
			arr.append(even)
			sm -= even
			even += 2
		arr.append(sm)
		print('YES')
		for item in arr:
			print(item, end=' ')
		print()


import sys
import math
input = sys.stdin.buffer.readline

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

def str_array():
	return input().strip().split()
for i in range(int(input())):
	n = int(input())
	ans = []
	for i in range(1, n // 2 + 1):
		ans += [2 * i]
	for i in range(1, (n // 2 - 1) * 2, 2):
		ans += [i]
	ans += [sum(ans[:n // 2]) - sum(ans[n // 2:n - 1])]
	for i in range(n // 2, n):
		if ans[i] % 2 == 0:
			state = 'NO'
			break
		else:
			state = 'YES'
	print(state)
	if state == 'YES':
		print(' '.join((str(v) for v in ans)))


for _ in range(int(input())):
	(n, k) = [int(s) for s in input().split()]
	arr = [int(s) for s in input().split()]
	f1 = [0] * (2 * k + 1)
	f2 = [0] * (2 * k + 1)
	f3 = [0] * (2 * k + 1)
	for i in range(n // 2):
		a = arr[i]
		b = arr[n - i - 1]
		f1[a + b] += 1
		f2[max(a, b) + k] += 1
		f3[1 + min(a, b)] += 1
	for i in range(2, 2 * k + 1):
		f2[i] += f2[i - 1]
		f3[i] += f3[i - 1]
	ans = int(1000000000.0)
	for i in range(1, 2 * k + 1):
		ans = min(ans, n // 2 - f1[i] + f2[i - 1] + f3[2 * k] - f3[i])
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 == 0:
		l = [2]
		q = [1]
		i = 1
		k = n // 4
		while i < n // 2:
			l.append(l[-1] + 2)
			if i < k:
				q.append(l[-1] - 1)
			else:
				q.append(l[-1] + 1)
			i += 1
		print('YES')
		print(*l + q, sep=' ')
	else:
		print('NO')
	t -= 1


from bisect import bisect_left
from collections import Counter
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	c = Counter((a[i] + a[-i - 1] for i in range(n // 2)))
	s1 = sorted((k + max(a[i], a[-i - 1]) for i in range(n // 2)))
	s2 = sorted((-1 - min(a[i], a[-i - 1]) for i in range(n // 2)))
	print(min((n // 2 - c[x] + bisect_left(s1, x) + bisect_left(s2, -x) for x in range(2, 2 * k + 1))))


from sys import stdin, stdout
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n % 4 == 0:
		stdout.write('YES' + '\n')
		for j in range(1, n // 2 + 1):
			stdout.write(str(j * 2) + ' ')
		for k in range(1, n // 2 + 1):
			if k == n // 2:
				stdout.write(str(k * 2 - 1 + n // 2) + '\n')
			else:
				stdout.write(str(k * 2 - 1) + ' ')
	else:
		stdout.write('NO' + '\n')


T = int(input())
for x in range(T):
	N = int(input())
	if N % 4 != 0:
		print('NO')
		continue
	print('YES')
	evens = []
	odds = []
	lastEven = -2
	for i in range(N // 4):
		evens.append(str(lastEven + 4))
		evens.append(str(lastEven + 6))
		odds.append(str(lastEven + 3))
		odds.append(str(lastEven + 7))
		lastEven += 6
	print(' '.join(evens), ' '.join(odds))


for i in range(int(input())):
	n = int(input())
	k = 0
	if n / 2 % 2 != 0:
		print('NO')
	else:
		s = n // 2 * (n // 2 + 1)
		j = 2
		print('YES')
		while j <= n:
			print(j, end=' ')
			j += 2
			k += 1
		j = 1
		h = 1
		q = 0
		while h < k:
			print(j, end=' ')
			if h == k - 1:
				break
			else:
				j += 2
				q = q + j
			h += 1
		print(s - q - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x % 2 == 0:
		print('YES')
		a = [0] * n
		x1 = x
		x //= 2
		e = 2
		i = 0
		while x:
			a[i] = e
			a[i + 1] = e + 2
			a[x1 + i] = e - 1
			a[x1 + i + 1] = e + 3
			i += 2
			x -= 1
			e += 6
		print(*a)
	else:
		print('NO')


def ans(n):
	mid = n // 2
	if mid % 2 is not 0:
		return ('NO', None)
	arr = [0] * n
	l = 0
	even = 2
	while l < mid:
		arr[l] = even
		even += 2
		l += 1
	even_count = sum(arr)
	odd_count = 0
	odd = 1
	while l < n - 1:
		arr[l] = odd
		odd_count += arr[l]
		l += 1
		odd += 2
	arr[l] = even_count - odd_count
	return ('YES', arr)
t = int(input())
for i in range(t):
	x = int(input())
	(a, b) = ans(x)
	if b is None:
		print(a)
	else:
		print(a)
		for i in range(len(b) - 1):
			print(b[i], end=' ')
		print(b[len(b) - 1])


t = int(input())
for i in range(t):
	n = int(input())
	temp = n // 2
	if temp % 2:
		print('NO')
		continue
	ouputeven = []
	e = 2
	for j in range(temp):
		ouputeven.append(e)
		e += 2
	outputodd = []
	s = 1
	for j in range(temp - 1):
		outputodd.append(s)
		s += 2
	outputodd.append(sum(ouputeven) - sum(outputodd))
	if outputodd[-1] % 2 and len(ouputeven) == len(list(set(outputodd))):
		print('YES')
		output = ouputeven + outputodd
		print(*output)
	else:
		print('NO')


def ans(n):
	if n % 4 != 0:
		return 'NO'
	arr = []
	for i in range(int(n / 2)):
		arr.append(2 * i + 2)
	for i in range(int(n / 2) - 1):
		arr.append(2 * i + 1)
	arr.append(sum(arr[0:int(n / 2)]) - sum(arr[int(n / 2):]))
	return arr
t = int(input())
L = []
for i in range(t):
	n = int(input())
	L.append(ans(n))
for l in L:
	if l == 'NO':
		print(l)
	else:
		print('YES')
		for i in l:
			print(i, end=' ')
		print()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4 == 0:
			print('YES')
			a = [i for i in range(2, n + 1, 2)]
			b = [i for i in range(1, n + 1, 2)]
			b[-1] = sum(a) - sum(b[:n // 2 - 1])
			a = a + b
			print(*a)
		else:
			print('NO')
	return
main()


for _ in range(int(input())):
	n = int(input())
	n = n // 2
	if n % 2:
		print('NO')
	else:
		print('YES')
		l1 = [i * 2 for i in range(1, n + 1)] + [i * 2 + 1 for i in range(n + 1)]
		l1.pop(n + n // 2)
		print(*l1)


t = int(input())

def is_odd(n):
	return n % 2 == 1
for _ in range(t):
	n = int(input())
	if is_odd(n // 2):
		print('NO')
		continue
	arr = list(range(1, n + 1))
	even = arr[1::2]
	odd = arr[::2][:-1]
	odd.append(sum(even) - sum(odd))
	print('YES')
	for ele in even + odd:
		print(ele, end=' ')
	print()


for _ in range(int(input())):
	n = int(input()) // 2
	if n % 2:
		print('NO')
	else:
		print('YES')
		first = [2]
		second = [1]
		for i in range(n - 1):
			first.append(first[-1] + 4)
			second.append(first[-1] + 1 - i % 2 * 2)
		print(*first, *second)


ii = lambda : int(input())
il = lambda : list(map(int, input().split()))
for _ in range(ii()):
	n = ii()
	a = []
	b = []
	c = []
	d = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				a.append(str(i))
				c.append(i)
		for i in range(1, n - 1):
			if i % 2 != 0:
				b.append(str(i))
				d.append(i)
		b.append(str(sum(c) - sum(d)))
		k = a + b
		print(' '.join(k))


for t in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		A = [0] * n
		e = 2
		toggle = -1
		for i in range(n // 2):
			A[i] = e
			A[n // 2 + i] = e + toggle
			e += 4
			toggle *= -1
		for a in A:
			print(a, end=' ')
		print()


def helper(n):
	if n / 2 % 2 != 0:
		return ['NO']
	else:
		result = [None] * n
		pointer1 = 0
		pointer2 = n // 2
		count = 0
		num = 2
		for i in range(n // 2):
			result[i] = num
			num += 2
		x = n // 2
		num = 1
		for i in range(n // 2, n):
			result[i] = num
			num += 2
		result[n - 1] += x
		return ['YES', result]
t = int(input())
while t > 0:
	n = int(input())
	data = helper(n)
	if len(data) == 1:
		print(data[0])
	else:
		print(data[0])
		for i in range(len(data[1])):
			print(data[1][i], end=' ')
	t -= 1


t = int(input())
case = []
for i in range(t):
	x = input().split()
	case.append(x)
for i in range(t):
	z = 0
	y = 1
	e = 0
	f = 0
	a = int(int(case[i][0]) / 2)
	if a % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(a):
			z = z + 2
			print(z, '', end='')
			e = e + z
		for j in range(a - 1):
			print(y, '', end='')
			f = f + y
			y = y + 2
		print(e - f)


a = int(input())
for i in range(a):
	c = d = []
	b = int(input())
	if b % 4 != 0:
		print('NO')
	else:
		c = list(range(2, b + 1, 2))
		d = list(range(1, b + 1, 2))
		d[-1] += int(b / 2)
		print('YES')
		print(*c + d)


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
t = int(input())
import bisect
while t:
	d = dd(int)
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ll = []
	mx = 1000000000000000
	mi = -1
	ll = []
	l2 = []
	ri = -1
	le = mx
	for i in range(n // 2):
		d[l[i] + l[n - i - 1]] += 1
		mx = min(mx, max(l[i], l[n - i - 1]))
		mi = max(mi, min(l[i], l[n - i - 1]))
		ll.append(max(l[i], l[n - i - 1]) + k)
		l2.append(min(l[i], l[n - i - 1]) + 1)
		le = min(le, l[i] + l[n - i - 1])
		ri = max(ri, l[i] + l[n - i - 1])
	res = n // 2
	ll.sort()
	l2.sort()
	ri = ll[-1]
	if le > ri:
		(le, ri) = (ri, le)
	mx = 0
	ind = 100000000000
	for i in range(le, ri + 1):
		cou = bisect.bisect_left(ll, i)
		cou2 = n // 2 - bisect.bisect_right(l2, i)
		if mx < d[i] - cou - cou2:
			mx = d[i] - cou - cou2
	cou = 0
	print(res - mx)
	t -= 1


for __ in range(int(input())):
	n = int(input())
	n //= 2
	if n & 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for i in range(1, n):
		print(i * 2 - 1, end=' ')
	print(3 * n - 1)


def bal_array(n):
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
		for i in range(1, n // 2):
			print(i * 2 - 1, end=' ')
		print(3 * n // 2 - 1)
n = int(input())
for i in range(n):
	testcase = int(input())
	bal_array(testcase)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(n, k) = R()
	cnt = [0] * (2 * k + 7)
	val = [0] * (2 * k + 7)
	(*a,) = R()
	for i in range(n // 2):
		cnt[a[i] + a[-i - 1]] += 1
		val[min(a[i], a[-i - 1]) + 1] += 1
		val[max(a[i], a[-i - 1]) + k + 1] -= 1
	ans = inf
	p = 0
	for i in range(2 * k + 7):
		p += val[i]
		ans = min(ans, (n // 2 - p) * 2 + p - cnt[i])
	print(ans)


for s in [*open(0)][1:]:
	n = int(s)
	a = range(1, n - 1)
	print(*(['YES'] + [*a[1::2]] + [n, n + n // 2 - 1] + [*a[::2]], ['NO'])[n // 2 % 2])


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


def balancedArray(n):
	if n % 4 != 0:
		return ('NO', False)
	evensum = n // 2 * (n // 2 + 1)
	oddsum = n // 2 - 1 + (n // 2 - 1) * (n // 2 - 2)
	L = [2 * (i + 1) for i in range(n // 2)] + [2 * (i + 1) - 1 for i in range(n // 2 - 1)] + [evensum - oddsum]
	return ('YES', L)
for i in range(int(input())):
	M = balancedArray(int(input()))
	if M[0] == 'NO':
		print('NO')
	else:
		print('YES')
		print(' '.join(list(map(str, M[1]))))


test = int(input())
while test:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = n
		c = 2
		print('YES')
		sum1 = 0
		sum2 = 0
		for i in range(l // 2):
			print(c, end=' ')
			sum1 += c
			c += 2
		c = 1
		for i in range(l // 2 - 1):
			print(c, end=' ')
			sum2 += c
			c += 2
		print(sum1 - sum2)
	test -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	dp = [0] * (2 * k + 2)
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		dp[2] += 2
		dp[x + 1] -= 1
		dp[y + k + 1] += 1
		dp[x + y] -= 1
		dp[x + y + 1] += 1
	for i in range(2, 2 * k):
		dp[i + 1] += dp[i]
	print(min(dp[2:2 * k + 1]))


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


def check(n):
	val = n // 2
	k = val * (val + 1)
	for i in range(2, n + 1, 2):
		print(i, end=' ')
	for i in range(1, n - 1, 2):
		k -= i
		print(i, end=' ')
	print(k)
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		check(n)


t = int(input())
while t > 0:
	n = input()
	n = int(n)
	le = []
	lo = []
	if n // 2 - 1 & 1 == 1:
		print('YES')
		i = 1
		k = 2
		while i <= n // 2:
			if i == n // 2:
				le.append(k)
				lo.append(k + (n // 2 - 1))
			else:
				le.append(k)
				lo.append(k - 1)
			k = k + 2
			i = i + 1
		for p in le:
			print(p, end=' ')
		for p1 in lo:
			print(p1, end=' ')
		print()
	else:
		print('NO')
	t = t - 1


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			print('YES')
			arr = []
			for i in range(n // 2):
				arr.append((i + 1) * 2)
			s = 0
			for i in range(n // 2 - 1):
				x = arr[i] - 1
				s += 1
				arr.append(x)
			x = arr[n // 2 - 1] + s
			arr.append(x)
			print(*arr)
main()


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		c = []
		d = []
		k = n + 0
		for j in range(1, n * 2):
			if k <= 0:
				break
			if j % 2 == 0:
				c.append(j)
			else:
				d.append(j)
			k -= 1
		d[n // 4] = d[-1] + 2
		print('YES')
		a = c + d
		print(*a)


def func(n):
	summ = 0
	sum2 = 0
	l = []
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print((i + 1) * 2, end=' ')
			summ += (i + 1) * 2
		for i in range(n // 2 - 1):
			print(2 * i + 1, end=' ')
			sum2 += i * 2 + 1
		print(summ - sum2)
t = int(input())
for i in range(t):
	n = int(input())
	func(n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lis = list(map(int, input().split()))
	ans = [0] * (2 * k + 2)
	pre = [0] * (2 * k + 2)
	has = [0] * (2 * k + 2)
	fin = 100000000000
	for i in range(n // 2):
		mm = min(lis[i], lis[n - i - 1])
		mx = max(lis[i], lis[n - i - 1])
		ans[mm + 1] += 1
		ans[mx + k + 1] -= 1
		has[mx + mm] += 1
	for i in range(1, 2 * k + 2):
		pre[i] = pre[i - 1] + ans[i]
	for i in range(2, 2 * k + 1):
		tem = pre[i] - has[i] + (n // 2 - pre[i]) * 2
		fin = min(fin, tem)
	print(fin)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	sumCnts = [0 for __ in range(2 * k + 1)]
	minimumSumsChange1 = [0 for __ in range(2 * k + 1)]
	maximumSumsChange1 = [0 for __ in range(2 * k + 1)]
	r = n - 1
	for l in range(n):
		if l > r:
			break
		(a, b) = (arr[l], arr[r])
		sumCnts[a + b] += 1
		minimumSumsChange1[min(a, b) + 1] += 1
		maximumSumsChange1[max(a, b) + k] += 1
		r -= 1
	change1 = [0 for __ in range(2 * k + 1)]
	cnt = 0
	for i in range(2 * k + 1):
		cnt += minimumSumsChange1[i]
		change1[i] = cnt
		cnt -= maximumSumsChange1[i]
	change2 = [0 for __ in range(2 * k + 1)]
	for i in range(2 * k + 1):
		change2[i] = n // 2 - change1[i]
	ans = float('inf')
	for x in range(2, 2 * k + 1):
		ans = min(ans, change1[x] - sumCnts[x] + 2 * change2[x])
	print(ans)


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(1, round(n / 2) + 1):
			a.append(2 * i)
		for j in range(1, round(n / 2)):
			a.append(2 * j - 1)
		a.append(2 * i + round(n / 2) - 1)
		b = []
		for k in range(len(a)):
			if k == len(a) - 1:
				b.append(str(a[k]))
			else:
				b.append(str(a[k]))
				b.append(' ')
		c = ''
		d = c.join(b)
		print(d)


import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right
Q = int(input())
Query = []
for _ in range(Q):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	Query.append((N, K, A))
for (N, K, A) in Query:
	MIN = []
	MAX = []
	dic = {}
	for n in range(N // 2):
		a1 = A[n]
		a2 = A[-1 - n]
		MIN.append(min(a1 + 1, a2 + 1))
		MAX.append(max(a1 + K, a2 + K))
		p = a1 + a2
		if p in dic:
			dic[p] += 1
		else:
			dic[p] = 1
	MIN.sort()
	MAX.sort()
	ans = 10 ** 14
	for k in range(2, 2 * K + 1):
		small_than_k = bisect_left(MAX, k)
		large_than_k = N // 2 - bisect_right(MIN, k)
		two = small_than_k + large_than_k
		zero = dic[k] if k in dic else 0
		one = N // 2 - two - zero
		ans = min(ans, two * 2 + one)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	alen = n // 2
	a = [i for i in range(2, alen * 2 + 1, 2)]
	asum = sum(a)
	b = []
	bsum = 0
	bind = 1
	for i in range(len(a) - 1):
		b.append(bind)
		bsum += bind
		bind += 2
	b.append(asum - bsum)
	ans = a + b
	ans = [str(i) for i in ans]
	ans = ' '.join(ans)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	sumEven = 0
	sumOdd = 0
	if n // 2 % 2 == 0:
		print('YES')
		for j in range(0, n // 2):
			a = 2 * (j + 1)
			sumEven = sumEven + a
			print(a, end=' ')
		for j in range(0, n // 2 - 1):
			a = 1 + 2 * j
			sumOdd = sumOdd + a
			print(a, end=' ')
		b = sumEven - sumOdd
		print(b)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		e = []
		o = []
		temp = 2
		for i in range(n // 2):
			e.append(temp)
			temp += 2
		temp = 1
		for i in range(n // 2):
			o.append(temp)
			temp += 2
		sum_e = sum(e)
		sum_o = sum(o)
		if sum_e > sum_o:
			diff = sum_e - sum_o
			o[-1] += diff
		else:
			diff = sum_o - sum_e
			e[-1] += diff
		print('YES')
		print(' '.join(map(str, e + o)))


t = int(input())
for testcase in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	first = [2 * x for x in range(1, n // 2 + 1)]
	second = [2 * x - 1 for x in range(1, n // 2)]
	for x in first:
		print(x, end=' ')
	for x in second:
		print(x, end=' ')
	print(2 * (n // 2) - 1 + n // 2)


for _ in range(int(input())):
	n = int(input())
	arr = []
	(sm1, sm2) = (0, 0)
	if n // 2 % 2 == 1:
		print('NO')
		continue
	for i in range(0, n // 2):
		arr.append(2 * (i + 1))
		sm1 += 2 * (i + 1)
	for i in range(0, n // 2 - 1):
		arr.append(2 * (i + 1) - 1)
		sm2 += 2 * (i + 1) - 1
	if (sm1 - sm2) % 2 == 0:
		arr.append(sm1 - sm2 + 1)
	else:
		arr.append(sm1 - sm2)
	print('YES')
	for x in arr:
		print(x, end=' ')
	print('')


for _ in range(int(input())):
	n = int(input())
	if n & 3 != 0:
		print('NO')
	else:
		print('YES')
		soln = [0] * n
		sumi = 0
		number = 2
		sumofnumbers = 0
		for i in range(n // 2):
			soln[i] = number
			soln[i + n // 2] = number - 1
			sumi += 1
			number += 2
		soln[n - 1] = sum(soln[:n // 2]) - sum(soln[n // 2:n - 1])
		print(*soln)


t = int(input())
from collections import defaultdict
import math
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	seq = list(map(int, input().split()))
	prefix_arr = [0] * (2 * k + 10)
	zero_count = defaultdict(int)
	for i in range(n // 2):
		zero_count[seq[i] + seq[n - i - 1]] += 1
		(a, b) = sorted((seq[i], seq[n - i - 1]))
		L = a + 1
		R = b + k
		prefix_arr[L] += 1
		prefix_arr[R + 1] -= 1
	prefsum = 0
	for i in range(2 * k + 10):
		prefsum += prefix_arr[i]
		prefix_arr[i] = prefsum
	ans = n
	for i in range(2, 2 * k + 1):
		zero = zero_count[i]
		ones = prefix_arr[i] - zero
		twos = n // 2 - ones - zero
		total = ones + twos * 2
		ans = min(ans, total)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	res = [None] * n
	for i in range(0, 3 * n // 2, 3):
		(e, o) = (i + 1, i + 2)
		if i % 2 == 0:
			(e, o) = (o, e)
		j = i // 3
		(res[j], res[n - j - 1]) = (e, o)
	res = ' '.join(map(str, res))
	print(res)


for i in range(int(input())):
	i = int(input())
	b = i // 2
	if b % 2 == 0:
		print('YES')
		a = [0] * (i - 1)
		s = 0
		c = 1
		s1 = 0
		g = 0
		for i in range(b):
			g += 2
			a[i] = g
			s += a[i]
			if i == b - 1:
				break
			a[i + b] = max(0, c)
			s1 = s1 + a[i + b]
			c += 2
		a.append(s - s1)
		for i in a:
			print(i, end=' ')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = ''
		sum = 0
		c = 2
		while c <= n:
			sum += c
			print(c, end=' ')
			c += 2
		c = 1
		p = 1
		while p < n / 2:
			p += 1
			sum -= c
			print(c, end=' ')
			c += 2
		print(sum)


test_cases = int(input())

def generate_evens(size):
	return [i for i in range(1, size + 1) if i % 2 == 0]

def generate_odds(size):
	return [i for i in range(1, size - 1) if i % 2 != 0]
for i in range(test_cases):
	size = int(input())
	if size % 4 == 0:
		print('YES')
		arr = generate_evens(size) + generate_odds(size) + [sum(generate_evens(size)) - sum(generate_odds(size))]
		print(' '.join([str(i) for i in arr]))
	else:
		print('NO')


import sys
for _ in range(int(input())):
	a = int(input())
	mas = [2]
	s1 = 2
	for i in range(a // 2 - 1):
		mas.append(mas[-1] + 2)
		s1 += mas[-1]
	mas2 = [1]
	s2 = 1
	for i in range(a // 2 - 1):
		mas2.append(mas2[-1] + 2)
		s2 += mas2[-1]
	if (s1 - s2) % 2 == 0:
		print('YES')
		print(*mas, end=' ')
		mas2[-1] += s1 - s2
		print(*mas2)
	else:
		print('NO')


cases = int(input())
for i in range(cases):
	case = int(input())
	arr = []
	out = ''
	if case // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(0, case // 2):
			arr.append((j + 1) * 2)
		for k in range(0, case // 2):
			arr.append((k + 1) * 2 - 1)
		arr[len(arr) - 1] += case // 2
		for k in arr:
			out += str(k) + ' '
		print(out)


def fun(n):
	if n == 2:
		print('NO')
		return
	if n / 2 % 2 == 1:
		print('NO')
		return
	print('YES')
	even = [i for i in range(1, n + 1) if i % 2 == 0]
	count = 0
	for i in even:
		print(i, end=' ')
	l = len(even)
	for i in range(l - 1):
		print(even[i] - 1, end=' ')
		count += 1
	print(even[l - 1] + count)
num = int(input())
for _ in range(num):
	n = int(input())
	fun(n)


import sys
import math
from collections import defaultdict

def lower(arr, num):
	if num > arr[-1]:
		return len(arr)
	(l, r) = (0, len(arr) - 1)
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] < num:
			l = mid + 1
			ans = mid
		else:
			r = mid - 1
	return ans

def lowera(arr, num):
	if num > arr[-1]:
		return len(arr) - 1
	(l, r) = (0, len(arr) - 1)
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] <= num:
			l = mid + 1
			ans = mid
		else:
			r = mid - 1
	return ans
t = int(sys.stdin.readline())
for _ in range(t):
	dic = defaultdict(int)
	(n, k) = map(int, sys.stdin.readline().split())
	arr = list(map(int, sys.stdin.readline().split()))
	small = []
	large = []
	(l, r) = (0, n - 1)
	while l <= r:
		dic[arr[l] + arr[r]] += 1
		small.append(min(arr[l], arr[r]))
		large.append(max(arr[l], arr[r]))
		l += 1
		r -= 1
	small.sort()
	large.sort()
	for i in range(len(small)):
		small[i] += 1
	for i in range(len(large)):
		large[i] += k
	small = [small[0] - 1] + small
	large = [large[0] - 1] + large
	ans = 10000000000.0
	for i in range(2, 2 * k + 1):
		a = lowera(small, i)
		b = lower(large, i)
		x = n // 2 - a
		if b < 1:
			y = 0
			b = 0
		s = x * 2 + a + y * 2 + b - dic[i]
		ans = min(ans, s)
	print(ans)


def RA():
	l = input().split()
	return [int(s) for s in l]

def solve():
	n = int(input())
	if not n % 4 == 0:
		print('NO')
		return
	result = list(range(2, n + 1, 2)) + list(range(1, n, 2))
	result[-1] += n // 2
	print('YES')
	print(*result)
t = int(input())
for i in range(t):
	solve()


t = int(input().strip())
for it in range(t):
	n = int(input().strip())
	possible = True
	if n % 4 != 0:
		possible = False
	if possible:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
		for i in range(0, n // 4):
			print(2 * i + 1, end=' ')
		for i in range(n // 4 + 1, n // 2 + 1):
			print(2 * i + 1, end=' ')
		print()
	else:
		print('NO')


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

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

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

def main():
	try:
		for _ in range(I()):
			n = I() // 2
			if n % 2 != 0:
				print('NO')
			else:
				d = []
				l = []
				for i in range(1, n + 1):
					d.append(2 * i + 1)
				for i in range(1, n + 1):
					l.append(2 * i)
				l[-1] += n
				print('YES')
				l.extend(d)
				print(*l)
	except:
		pass
M = 998244353
P = 1000000007
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		arr = []
		sm = 0
		for i in range(2, n + 1, 2):
			sm += i
			arr.append(i)
		ev = sm
		i = 1
		x = 0
		while x < n - 2:
			arr.append(i)
			sm -= i
			i += 2
			x += 2
		if sm % 2 == 0:
			arr.append(sm - 1)
		else:
			arr.append(sm)
		arr = list(map(str, arr))
		print(' '.join(arr))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	temp = n // 2
	l = []
	if temp % 2 != 0:
		print('NO')
	else:
		print('YES')
		s1 = 0
		for i in range(2, 2 * temp + 1, 2):
			l.append(i)
			s1 = s1 + i
		s2 = 0
		for j in range(1, 2 * (temp - 1), 2):
			l.append(j)
			s2 = s2 + j
		l.append(s1 - s2)
		for i in l:
			print(i, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	L = [n for j in range(n)]
	if n % 4 == 0:
		a = n // 2
		for k in range(0, a):
			L[k] = 2 * (k + 1)
			L[k + a] = 2 * k + 1
		L[n - 1] = n + (a - 1)
		print('YES')
		ch = ''
		for x in L:
			ch += str(x) + ' '
		print(ch)
	else:
		print('NO')


t = int(input())
for hh in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		li = []
		half = n // 2
		su = 0
		su2 = 0
		for i in range(1, half + 1):
			li.append(2 * i)
			su += 2 * i
		for i in range(1, half):
			li.append(2 * i - 1)
			su2 += 2 * i - 1
		li.append(su - su2)
		print(*li)


for w in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		l = []
		l1 = []
		print('YES')
		for i in range(2, n + 1, 2):
			l.append(i)
		for i in range(1, n - 1, 2):
			l1.append(i)
		x = sum(l) - sum(l1)
		l1.append(x)
		l.extend(l1)
		print(*l)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		c = []
		r = 0
		l = 0
		t = n // 2 * (n // 2 + 1)
		for i in range(1, n // 2 + 1):
			c.append(2 * i)
			l += 2 * i
		for i in range(1, n // 2):
			c.append(2 * i - 1)
			r += 2 * i - 1
		if (t - r) % 2 != 0:
			c.append(t - r)
			print('YES')
			print(' '.join(map(str, c)))
		else:
			print('NO')
	else:
		print('NO')


def dhana(n):
	a = n // 2
	l1 = []
	l2 = []
	for i in range(1, a + 1):
		if i != a:
			b = 2 * i
			c = b - 1
			l1.append(b)
			l2.append(c)
		else:
			b = 2 * i
			l1.append(b)
	d = sum(l1) - sum(l2)
	if d % 2 != 0:
		l2.append(d)
		l = l1 + l2
		print('YES')
		print(*l)
	else:
		print('NO')
z = int(input())
for i in range(z):
	n = int(input())
	dhana(n)


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(1, round(n / 2) + 1):
			a.append(str(2 * i))
		for j in range(1, round(n / 2)):
			a.append(str(2 * j - 1))
		a.append(str(2 * i + round(n / 2) - 1))
		g = ' '.join(a)
		print(g)


t = int(input())
for test in range(t):
	n = int(input())
	half = n // 2
	if half % 2 != 0:
		print('NO')
		continue
	arr1 = [int(x) for x in range(2, n + 1, 2)]
	sumt = half * (half + 1)
	arr2 = [int(x) for x in range(1, n - 1, 2)]
	arr2.append(sumt - (half - 1) ** 2)
	arr1 = arr1 + arr2
	print('YES')
	for i in range(n):
		if i == n - 1:
			print(arr1[i])
		else:
			print(arr1[i], end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		arr = [] * n
		for i in range(int(n / 2)):
			k = 2 * (i + 1)
			arr.append(k)
		for i in range(int(n / 2)):
			k = arr[i] - 1
			arr.append(k)
		arr[-1] = int(arr[-1] + n / 2)
		print('YES')
		print(*arr)


t = int(input())
for n in range(t):
	array_size = int(input())
	if array_size // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		array = []
		for i in range(array_size // 2):
			array.append((i + 1) * 2)
		for i in range(array_size // 2):
			array.append((i + 1) * 2 - 1)
		array[array_size - 1] += array_size // 2
		output = ''
		for i in array:
			output += '{} '.format(i)
		print(output)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		x = list(range(2, n + 1, 2))
		m = n // 2
		y = list(range(1, n - 2, 2))
		y.append(y[-1] + m + 2)
		print('YES')
		print(*x, *y)
	else:
		print('NO')


total = int(input())
numbers = [0] * total
for i in range(total):
	numbers[i] = int(input())
for number in numbers:
	if number % 4 == 0:
		print('YES')
		arr = []
		for evens in range(2, number + 1, 2):
			arr.append(evens)
		for odds in range(1, number, 2):
			arr.append(odds)
		arr[len(arr) - 1] += number // 2
		for numb in arr:
			print(numb, end=' ')
		print(end='\n')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	m = n // 2
	if m % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, m + 1):
			(print(2 * i, ' '),)
		for j in range(1, m):
			(print(j * 2 - 1, ' '),)
		(print(3 * m - 1),)


t = int(input())
for case in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		l = [None] * n
		for i in range(n // 2):
			l[i] = 2 * (i + 1)
			if i < n // 2 - 1:
				l[i + n // 2] = l[i] - 1
			else:
				l[i + n // 2] = l[i] + (n // 2 - 1)
		print('YES')
		for item in l:
			print(item, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a1 = [2 * j for j in range(1, n // 2 + 1)]
		a2 = [2 * k + 1 for k in range(n // 2 - 1)]
		a3 = [sum(a1) - sum(a2)]
		a = a1 + a2 + a3
		print(*a, sep=' ')


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')
t = int(input())
from collections import Counter
from bisect import bisect, bisect_left
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = 2000000
	l1 = []
	l2 = []
	l3 = []
	l4 = []
	l5 = []
	for j in range(n // 2):
		y = l[j] + l[n - 1 - j]
		l1.append(y)
		l2.append(max(l[j], l[n - 1 - j]) + k)
		l3.append(min(l[j], l[n - 1 - j]) + 1)
	c = Counter(l1)
	ans = n // 2
	l3.sort()
	l2.sort()
	for (a, b) in c.most_common(n // 2):
		if b == 0:
			break
		z1 = bisect(l3, a)
		z = bisect_left(l2, a)
		ans = min(ans, 2 * z + 2 * (n // 2 - z1) - z + z1 - b)
	print(ans)


def even(n):
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		odd = []
		even = []
		i = 1
		while i <= n:
			if i % 2 != 0:
				odd.append(i)
				i = i + 1
			if i % 2 == 0:
				even.append(i)
				i = i + 1
		if sum(even) == sum(odd):
			print(*even + odd)
		else:
			if sum(even) > sum(odd):
				odd[len(odd) - 1] = sum(even) - sum(odd[0:len(odd) - 1])
			print(*even + odd)
t = int(input())
for i in range(t):
	n = int(input())
	even(n)


t = int(input())
while t > 0:
	ans = []
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		t -= 1
		continue
	else:
		print('YES')
	fh = int(n / 2)
	fh_ = 0
	for i in range(1, fh + 1):
		print(str(i * 2) + ' ', end='')
		fh_ += i * 2
	sh_ = 0
	for i in range(0, fh):
		if i == fh - 1:
			print(fh_ - sh_)
		else:
			sh_ += 1 + 2 * i
			print(str(1 + i * 2) + ' ', end='')
	t -= 1


testCases = int(input())
while testCases > 0:
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	(opened, closed, exist) = ({}, {}, {})
	for i in range(2 * k + 1):
		opened[i] = closed[i] = exist[i] = 0
	for i in range(int(n / 2)):
		(L, R) = (a[i], a[n - 1 - i])
		exist[L + R] += 1
		opened[1 + min(L, R)] += 1
		closed[k + max(L, R)] += 1
	(Answer, inside) = (10 ** 9, 0)
	for i in range(2 * k + 1):
		inside += opened[i]
		Answer = min(Answer, n - exist[i] - inside)
		inside -= closed[i]
	print(Answer)
	testCases -= 1


import sys
input = sys.stdin.readline

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

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

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

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

def print_list_int(l):
	print(' '.join(map(str, map(int, l))))
t = inp()
for test in range(t):
	n = inp()
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		out = [2 * (x + 1) for x in range(n // 2)]
		out2 = [2 * x + 1 for x in range(n // 2 - 1)]
		out2.append(sum(out) - sum(out2))
		out.extend(out2)
		print_list_int(out)


n = int(input())
for i in range(n):
	m = int(input())
	if m % 4 == 0:
		print('YES')
		a = []
		for i in range(int(m / 2)):
			a += [2 * i + 2]
		for i in range(int(m / 2) - 1):
			a += [2 * i + 1]
		a += [m + int(m / 2) - 1]
		print(' '.join(map(str, a)))
	else:
		print('NO')


inputs = [int(input()) for i in range(int(input()))]
output = []
for i in inputs:
	if i // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for k in range(2, i + 1, 2):
			output.append(k)
		a = len(output)
		for j in range(1, i - 1, 2):
			output.append(j)
		output.append(i + a - 1)
		print(*output)
		output.clear()


test_case = int(input())
while test_case:
	n = int(input())
	if n / 2 % 2:
		print('NO')
	else:
		even_series = [i for i in range(2, n + 1, 2)]
		odd_series = [i for i in range(1, n - 2, 2)] + [n // 2 * (n // 2 + 1) - (n // 2 - 1) ** 2]
		print('YES')
		print(*even_series + odd_series)
	test_case -= 1


T = int(input())
for t in range(T):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		A = [2 * i for i in range(1, n // 2 + 1)]
		sum_A = sum(A)
		B = [2 * i - 1 for i in range(1, n // 2 + 1)]
		B[-1] += sum(A) - sum(B)
		A.extend(B)
		print(*A)


a = int(input())
for i in range(0, a):
	n = int(input())
	arr = []
	if n % 4 == 0:
		print('YES')
		for i in range(0, n // 2):
			arr.append(2 * (i + 1))
		for i in range(0, n // 2):
			if i < n // 4:
				arr.append(arr[i] - 1)
			else:
				arr.append(arr[i] + 1)
		print(' '.join(list(map(str, arr))))
	else:
		print('NO')


import math as m
t = int(input())
while t:
	n = int(input())
	if n % 4 == 0:
		print('YES')
		x = int(n / 2)
		a = []
		s = 0
		s1 = 0
		for i in range(x):
			a.append(2 * i + 2)
			s += 2 * i + 2
		for i in range(x - 1):
			a.append(2 * i + 1)
			s1 += 2 * i + 1
		a.append(s - s1)
		for i in a:
			print(i, end=' ')
		print()
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	m = []
	if n / 2 % 2 != 0 or n % 2 != 0:
		print('NO')
	else:
		s = int(n / 2)
		z = 0
		l = 0
		for k in range(s):
			m.append(2 * (k + 1))
			z += 2 * (k + 1)
		for j in range(s - 1):
			m.append(2 * j + 1)
			l += 2 * j + 1
		m.append(z - l)
		print('YES')
		for i in range(len(m)):
			print(m[i], end=' ')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	print(*range(2, n + 1, 2), sep=' ', end=' ')
	print(*range(1, n // 2, 2), sep=' ', end=' ')
	print(*range(n // 2 + 3, n + 2, 2), sep=' ')


for x in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		k = []
		for i in range(n // 2):
			k.append((i + 1) * 2)
		j = sum(k)
		for i in range(n // 2 - 1):
			k.append(2 * i + 1)
			j = j - 2 * i - 1
		k.append(j)
		print('YES')
		print(*k)


tests = int(input())
while tests > 0:
	arrayLength = int(input())
	if arrayLength % 4 == 0:
		print('YES')
		evenArray = []
		oddArray = []
		for i in range(1, arrayLength + 1):
			if i % 2 == 0:
				evenArray.append(i)
			else:
				oddArray.append(i)
		oddArray[-1] = oddArray[-1] + arrayLength // 2
		print(*evenArray + oddArray)
	else:
		print('NO')
	tests = tests - 1


import sys
import math
n = int(input())
for i in range(n):
	t = int(input())
	if t % 4 == 0:
		print('YES')
		a = []
		b = []
		p = int(t // 2)
		j = 0
		x = 2
		y = 1
		for j in range(p):
			a.append(x)
			b.append(y)
			x += 2
			y += 2
		b.pop()
		b.append(3 * p - 1)
		c = a + b
		print(*c)
	else:
		print('NO')


def solve():
	n = int(input())
	mid = n // 2
	if mid % 2 != 0:
		print('NO')
		return
	print('YES')
	result = []
	even = 2
	tot = 0
	for i in range(mid):
		result.append(even)
		tot += even
		even += 2
	odd = 1
	while mid > 1:
		result.append(odd)
		tot -= odd
		odd += 2
		mid -= 1
	result.append(tot)
	print(' '.join(map(str, result)))
t = int(input())
for i in range(t):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	x = int(n / 2)
	if n == 2 or x % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		temp = []
		for i in range(1, x + 1):
			temp.append(2 * i)
		for i in range(1, x + 1):
			temp.append(2 * i - 1)
		temp[-1] += x
		print(*temp)


from bisect import bisect_left
from collections import Counter

def solve(n, k, a):
	s = [a[i] + a[n - i - 1] for i in range(n // 2)]
	amin = sorted([min(a[i], a[n - i - 1]) for i in range(n // 2)])
	amax = sorted([max(a[i], a[n - i - 1]) for i in range(n // 2)])
	ans = float('inf')
	counter = Counter(s)
	for v in range(2 * k + 1):
		count = n // 2 - bisect_left(amin, v)
		count1 = bisect_left(amax, v - k)
		count2 = n // 2 - count - count1
		count3 = counter[v]
		ans = min(ans, (count + count1) * 2 + count2 - count3)
	return ans

def main():
	tc = int(input())
	inp = lambda : [int(x) for x in input().split()]
	for _ in range(tc):
		(n, k) = inp()
		a = inp()
		print(solve(n, k, a))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	if m % 2:
		print('NO')
	else:
		print('YES')
		arr = list(range(n))
		for i in range(m):
			arr[i] = i + i + 2
		p = m + m // 2
		for i in range(m, p):
			arr[i] = (i - m) * 2 + 1
		for i in range(p, n):
			arr[i] = (i - m) * 2 + 3
		print(' '.join(map(str, arr)))


y = input()
n = int(y)
for i in range(0, n, 1):
	import array
	arre = array.array('l', [])
	arro = array.array('l', [])
	x = input()
	a = int(x)
	o = 0
	l = int(a / 2)
	e = 0
	for j in range(2, a + 1, 2):
		arre.append(j)
		e = e + j
	for j in range(1, a - 1, 2):
		arre.append(j)
		pk = j
		o = o + j
	c = int(e - o)
	arre.append(c)
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(*arre)


t = int(input())
for i in range(t):
	n = int(input())
	h = int(n / 2)
	if int(h % 2) == 0:
		print('YES')
		l = []
		m = []
		for i in range(1, h + 1):
			e = int(2 * i)
			l.append(e)
			if i == h:
				f = sum(l) - sum(m)
				m.append(f)
			else:
				f = e - 1
				m.append(f)
		a = l + m
		print(*a)
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	price = [0] * (2 * k + 5)
	for i in range(n // 2):
		price[2] += 2
		s = min(a[i], a[n - i - 1])
		l = max(a[i], a[n - i - 1])
		price[s + 1] -= 1
		price[s + l] -= 1
		price[s + l + 1] += 1
		price[l + k + 1] += 1
	sum = 0
	maxi = 1000000000000.0
	for i in price[2:2 * k + 2]:
		sum += i
		maxi = min(maxi, sum)
	print(maxi)


count = int(input())
for i in range(count):
	n = int(input())
	chet = []
	nechet = []
	s = []
	pechat = ''
	if n % 4 == 0:
		print('YES')
		for i in range(1, int(n / 2) + 1):
			chet.append(i * 2)
			pechat += str(i * 2)
			pechat += ' '
		for i in range(1, int(n / 2)):
			nechet.append(i * 2 - 1)
			pechat += str(i * 2 - 1)
			pechat += ' '
		pechat += str(sum(chet) - sum(nechet))
		print(pechat)
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		t -= 1
		continue
	else:
		print('YES')
	fh = int(n / 2)
	for i in range(1, fh + 1):
		print(str(i * 2) + ' ', end='')
	for i in range(1, fh + 1):
		if i == fh:
			print(str(3 * fh - 1))
		else:
			print(str(i * 2 - 1) + ' ', end='')
	t -= 1


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		ans.append('NO')
	else:
		a = [str(x) for x in range(2, n + 1, 2)] + [str(x) for x in range(1, n, 2)]
		a[-1] = str(int(a[-1]) + n // 2)
		ans.append('YES')
		ans.append(' '.join(a))
[print(x) for x in ans]


for _ in range(int(input())):
	t = int(input())
	a = []
	add = 0
	if int(t / 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(t / 2) + 1):
			a.append(2 * i)
			add += 2 * i
		z = 0
		j = int(t / 2)
		k = 1
		while j < t - 1:
			z += k
			a.append(k)
			k += 2
			j += 1
		final = add - z
		a.append(final)
		for y in a:
			print(y, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		print(*range(2, n + 1, 2), *range(1, n - 1, 2), 3 * n // 2 - 1)


t = int(input())
for tt in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = []
		b = []
		for i in range(2, n + 1, 2):
			a.append(i)
			if i <= n // 2:
				b.append(i - 1)
			else:
				b.append(i + 1)
		a.extend(b)
		print('YES')
		print(' '.join(map(str, a)))


import math as m
t = input()
tt = float(t)
ii = 0
while ii < tt:
	n = int(input())
	if n % 4 != 0:
		print('NO ')
	else:
		n1 = n / 2
		a = []
		i = 1
		sum = 0
		sum2 = 0
		while i <= n1:
			a.append(2 * i)
			sum = sum + 2 * i
			i = i + 1
		i = 1
		while i < n1:
			a.append(2 * i - 1)
			sum2 = sum2 + 2 * i - 1
			i = i + 1
		print('YES ')
		a.append(sum - sum2)
		for x in a:
			print(x)
	ii = ii + 1


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	p = i = 0
	if n // 2 % 2 != 0:
		print('NO')
	else:
		for r in range(n // 2):
			a.append(2 * (r + 1))
			p += 2 * (r + 1)
		l = 1
		for k in range(n // 2, n):
			a.append(l)
			if k != n - 1:
				i += l
			l += 2
		if (p - i) % 2 != 0:
			print('YES')
			a[n - 1] = p - i
			a = [str(x) for x in a]
			b = ' '.join(a)
			print(b)
		else:
			print('NO')


from sys import stdin, stdout

def main():
	for _ in range(int(stdin.readline())):
		(n, k) = map(int, stdin.readline().split())
		arr = [int(k) for k in stdin.readline().split()]
		freq = {}
		prefix = [0 for _ in range(2 * k + 2)]
		for i in range(n // 2):
			sm = arr[i] + arr[n - i - 1]
			if sm not in freq:
				freq[sm] = 1
			else:
				freq[sm] += 1
			l = min(arr[i], arr[n - i - 1]) + 1
			prefix[l] += 1
			u = max(arr[i], arr[n - i - 1]) + k
			prefix[u + 1] -= 1
		for i in range(3, 2 * k + 2):
			prefix[i] = prefix[i] + prefix[i - 1]
		ans = 100000
		for i in range(2, 2 * k + 1):
			one = prefix[i]
			if i in freq:
				zero = freq[i]
			else:
				zero = 0
			effective = one - zero
			two = n // 2 - one
			ans = min(ans, two * 2 + effective)
		stdout.write(str(ans) + '\n')
main()


t = int(input())
for _t in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		t1 = [2 * i for i in range(1, n // 2 + 1)]
		t2 = [2 * i - 1 for i in range(1, n // 2)]
		t3 = [t1[-1] + n // 2 - 1]
		print(*t1 + t2 + t3)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = [2 * i for i in range(1, n // 2 + 1)]
		b = [2 * i - 1 for i in range(1, n // 2)]
		current = sum(b)
		b.append(sum(a) - current)
		print('YES')
		print(' '.join(map(str, a + b)))


for _ in range(int(input())):
	n = int(input())
	if n / (1 + 1) % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
	l = [0] * n
	k = 2
	for i in range(0, n // (1 + 1), 1 + 1):
		l[i] = k
		l[-i - 1] = k - 1
		l[i + 1] = k + 1 + 1
		l[-i - 1 - 1] = k + 3
		k += 8
	for i in range(n):
		print(l[i], end=' ')
	print()


for z in range(int(input())):
	n = int(input())
	L = [2]
	for i in range(2, int(n / 2) + 1):
		L.append(2 * i)
	for j in range(int(n / 2) - 1):
		L.append(2 * j + 1)
	odd_sum = (int(n / 2) - 1) ** 2
	w = int(n / 2)
	even_sum = 2 * (w * (w + 1) / 2)
	ans = even_sum - odd_sum
	if ans % 2 != 0:
		L.append(int(ans))
		print('YES')
		print(*L)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0 or n // 2 % 2 != 0:
		print('NO')
		continue
	a = []
	b = []
	i = 2
	ct = 0
	print('YES')
	while ct < n // 2:
		a.append(i)
		b.append(i - 1)
		ct += 1
		i += 2
	b.pop()
	sm = sum(a) - sum(b)
	b.append(sm)
	print(*a + b)


def findarr(n):
	if n % 4 != 0:
		print('NO')
		return None
	print('YES')
	size = n // 2
	last = size * (size + 1) - (size - 1) ** 2
	for i in range(1, size + 1):
		print(i * 2, end=' ')
	for i in range(1, size):
		print(2 * i - 1, end=' ')
	print(last)
t = int(input())
for i in range(t):
	findarr(int(input()))


tc = int(input())
for eachi in range(tc):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = []
		b = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				a.append(i)
			else:
				b.append(i)
		b[n // 2 - 1] = b[n // 2 - 1] + n // 2
		for i in a:
			print(i, end=' ')
		for i in b:
			print(i, end=' ')
		print()
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	even = []
	odd = []
	if n / 2 % 2 == 0:
		print('YES')
		for i in range(1, n // 2 + 1):
			even.append(i * 2)
		for i in range(0, n // 2):
			odd.append(i * 2 + 1)
			l = n / 2
		while l * (l + 1) != (l - 1) * (l - 1) + odd[-1]:
			odd[-1] += 2
		for i in even + odd:
			print(i, end=' ')
	else:
		print('NO')


import sys, math
I = sys.stdin.readline
for _ in range(int(I())):
	n = int(I())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = []
		k = 2
		e = 0
		for i in range(n // 2):
			e += k
			a.append(k)
			k += 2
		k = 1
		o = 0
		for i in range(n // 2 - 1):
			o += k
			a.append(k)
			k += 2
		a.append(e - o)
		print('YES')
		print(*a)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	for e in range(2, n + 1, 2):
		print(e, end=' ')
	for o in range(1, n, 2):
		if o == n - 1:
			print(o + n // 2, end=' ')
			continue
		print(o, end=' ')
	print()


cases = int(input())
while cases:
	cases -= 1
	n = int(input())
	if n % 4 == 0:
		print('YES')
		(odd, even) = (0, 0)
		for i in range(1, n // 2 + 1):
			even += 2 * i
			print(2 * i, end=' ')
		for i in range(1, n // 2):
			odd += 2 * i - 1
			print(2 * i - 1, end=' ')
		print(even - odd)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	x = 2
	sum1 = 0
	for i in range(n // 2):
		li.append(x)
		sum1 += x
		x += 2
	y = 1
	sum2 = 0
	for i in range(n // 2, n - 1):
		li.append(y)
		sum2 += y
		y += 2
	if (sum1 - sum2) % 2 == 0:
		print('NO')
	else:
		li.append(sum1 - sum2)
		print('YES')
		for i in li:
			print(i, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	a = n // 2
	b = n - a
	if b % 2 != 0:
		print('NO')
	else:
		l1 = []
		num1 = 2
		while a > 0:
			l1.append(num1)
			num1 = num1 + 2
			a = a - 1
		c = b - 1
		l2 = []
		num2 = 1
		while c > 0:
			l2.append(num2)
			num2 = num2 + 2
			c = c - 1
		d = sum(l1)
		e = sum(l2)
		f = d - e
		l2.append(f)
		print('YES')
		for i in l1:
			print(i, end=' ')
		for i in l2:
			print(i, end=' ')


def palindrome(n, k, array):
	zero = [0 for i in range(2 * k - 1)]
	one = [0 for i in range(2 * k)]
	for s in range(n // 2):
		(a, b) = (array[s], array[n - 1 - s])
		zero[a + b - 2] += 1
		one[min(a, b) - 1] += 1
		one[max(a, b) + k - 1] -= 1
	for i in range(1, 2 * k):
		one[i] += one[i - 1]
	minimum = n // 2
	for i in range(2 * k - 1):
		if n - zero[i] - one[i] < minimum:
			minimum = n - zero[i] - one[i]
	return minimum
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	print(palindrome(n, k, array))


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		res = []
		even = 2
		for i in range(n // 2):
			res.append(even)
			even += 2
		s = sum(res)
		odd = 1
		for i in range(n // 2, n + 1):
			res.append(odd)
			odd += 2
		k = sum(res[n // 2:])
		res.remove(k - s)
		print(' '.join(map(str, res)))
	t -= 1


k = int(input())
for i in range(k):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = n // 2
		st = ''
		for i in range(1, a + 1):
			st += str(2 * i)
			st += ' '
		for i in range(a - 1):
			st += str(2 * i + 1)
			st += ' '
		st += str(2 * a - 1 + a)
		print(st)


from sys import stdin
n = int(input())
for i in range(n):
	num = int(stdin.readline())
	if num / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		for i in range(2, num + 1, 2):
			arr.append(i)
		for i in range(0, num // 2 - 1):
			arr.append(1 + 2 * i)
		arr.append(sum(arr[:num // 2]) - sum(arr[num // 2:]))
		for num in arr:
			print(num, end=' ')
		print()


test = int(input())
for i in range(test):
	n = int(input())
	ans = []
	str = 'NO'
	t = int(n / 2)
	if (t * (t + 1) - (t - 1) ** 2) % 2 == 0:
		print(str)
	else:
		str = 'YES'
		for j in range(int(n / 2)):
			ans.append((j + 1) * 2)
		for k in range(int(n / 2) - 1):
			ans.append(2 * k + 1)
		ans.append(t * (t + 1) - (t - 1) ** 2)
		print(str)
		for i in ans:
			print(i, end=' ')


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()
res = ['YES', 'NO']
t_c = ii()
for _ in range(t_c):
	n = ii()
	n //= 2
	f = n % 2
	print(res[f])
	if f:
		continue
	a = [i for i in range(2, 2 * n + 1, 2)]
	for i in range(n // 2):
		a.append(a[i] - 1)
	for i in range(n // 2, n):
		a.append(a[i] + 1)
	print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	if int(n / 2) % 2 != 0:
		print('No')
		continue
	for i in range(1, n + 1, 2):
		a.append(i + 1)
	c = a[-1]
	for i in range(1, n - 2, 2):
		a.append(i)
	a.append(c + int(n / 2) - 1)
	print('Yes')
	a = ' '.join(list(map(str, a)))
	print(a)


for tt in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO', end='')
	else:
		(mlist, e, o, p) = ([], 2, 1, 0)
		while p < n / 2:
			mlist.append(e)
			e += 2
			p += 1
		(sumeven, sumodd, listodd) = (sum(mlist), 0, [])
		while sumodd < sumeven:
			listodd.append(o)
			sumodd += o
			o += 2
		if (sumodd - sumeven) % 2 == 0 or sumodd - sumeven not in listodd:
			print('NO', end='')
		else:
			listodd.remove(sumodd - sumeven)
			print('YES')
			for i in mlist:
				print(i, end=' ')
			for i in listodd:
				print(i, end=' ')
	print()


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	lis = [i for i in range(2, n + 1, 2)]
	for i in lis:
		print(i, end=' ')
	for i in lis[:n // 2 - 1]:
		print(i - 1, end=' ')
	print(lis[-1] - 1 + n // 2)


tcases = int(input().strip())
for case in range(tcases):
	n = int(input().strip())
	if n % 4 == 0:
		print('YES')
		ev = [2 * i for i in range(1, n // 2 + 1)]
		od = [x - 1 for x in ev]
		od[-1] += n // 2
		print(*ev, *od)
	else:
		print('NO')


cases = input()
cases = int(cases)
for number in range(cases):
	x = input()
	x = int(x) // 2
	evens = []
	tot_ev = 0
	tot_od = 0
	for even in range(1, x + 1):
		tot_ev = tot_ev + 2 * even
		evens.append(2 * even)
	for odd in range(1, x):
		tot_od = tot_od + 2 * odd - 1
		evens.append(2 * odd - 1)
	last_num = tot_ev - tot_od
	if last_num % 2 == 1:
		print('YES')
		evens.append(last_num)
		print(*evens, sep=' ')
	else:
		print('NO')


import math
t = int(input())
while t:
	n = int(input())
	l = []
	if n % 4 == 0:
		print('YES')
		for i in range(1, int(n / 2) + 1):
			l.append(2 * i)
		for i in range(1, int(n / 4) + 1):
			l.append(2 * i - 1)
		for i in range(int(n / 4) + 1, int(n / 2) + 1):
			l.append(2 * i + 1)
		print(*l)
	else:
		print('NO')
	t = t - 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [0] * (n // 2)
	arr1 = [0] * (n // 2)
	if n // 2 % 2 != 0:
		print('NO')
	else:
		for i in range(n // 2):
			arr[i] = 2 * (i + 1)
		s = sum(arr)
		for j in range(n // 2 - 1):
			arr1[j] = 2 * j + 1
		t = sum(arr1)
		arr1[-1] = s - t
		print('YES')
		z = arr + arr1
		print(*z)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	sum_costs = [n // 2] * (k * 2 + 1)
	lower_penalties = [0] * (k * 2 + 1)
	upper_penalties = [0] * (k * 2 + 1)
	for (ai, aj) in zip(a[:n // 2], reversed(a[n // 2:])):
		sum_costs[ai + aj] -= 1
		lower_penalties[min(ai, aj)] += 1
		if max(ai, aj) < k:
			upper_penalties[max(ai, aj) + k + 1] += 1
	for j in range(k * 2 - 1, -1, -1):
		lower_penalties[j] += lower_penalties[j + 1]
	for j in range(1, k * 2 + 1):
		upper_penalties[j] += upper_penalties[j - 1]
	for j in range(k * 2 + 1):
		sum_costs[j] += lower_penalties[j] + upper_penalties[j]
	print(min(sum_costs[2:]))


t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2
	if half % 2 == 1:
		print('NO')
	else:
		res = []
		j = 2
		for i in range(half):
			res.append(j)
			j += 2
		j = 1
		for i in range(half - 1):
			res.append(j)
			j += 2
		ssum = half * (half + 1)
		ssum_last_term_removed = (half - 1) * half
		ssum_odd_last_term_removed = ssum_last_term_removed - (half - 1)
		res.append(ssum - ssum_odd_last_term_removed)
		print('YES')
		print(' '.join(map(str, res)))


t = int(input())
for i in range(0, t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		p = 2
		for j in range(0, n // 2):
			l.append(p)
			p += 2
		p = 1
		for j in range(0, n // 2):
			l.append(p)
			p += 2
			if p == (l[0] + l[n // 2 - 1]) // 2:
				p += 2
		print(*l)


a = int(input())
for i in range(a):
	b = int(input())
	if b % 4 != 0:
		print('No')
	else:
		print('Yes')
		str1 = ''
		str2 = ' '
		s = b / 2 * (b / 2 + 1)
		i = 2
		s1 = 0
		while i < b:
			str1 += str(i) + ' '
			str2 += str(i - 1) + ' '
			s1 += i - 1
			i += 2
		str1 += str(i)
		str2 += str(int(s - s1))
		print(str1 + str2)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = range(2, n + 1, 2)
		o = range(1, n - 2, 2)
		print(*e, *o, sum(e) - sum(o))


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		b = [2 * x - 1 for x in range(1, n // 2 + 1)]
		b[-1] += n // 2
		print(' '.join([str(2 * x) for x in range(1, n // 2 + 1)]) + ' ' + ' '.join([str(x) for x in b]))


t = int(input())
for x in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		z = 1
		y = 1
		l = []
		for num1 in range(int(n / 2)):
			l.append(2 * z)
			z += 1
		for num2 in range(int(n / 2)):
			l.append(y)
			y = y + 2
		l[-1] = int(n / 2) * 2 - 1 + int(n / 2)
		print('YES')
		for x in l:
			print(x, end=' ')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	imos = [0] * (2 * k + 2)
	for i in range(n // 2):
		(s, t) = (a[i], a[n - 1 - i])
		(s, t) = (min(s, t), max(s, t))
		imos[2] += 2
		imos[s + 1] -= 2
		imos[s + 1] += 1
		imos[s + t] -= 1
		imos[s + t + 1] += 1
		imos[k + t + 1] -= 1
		imos[k + t + 1] += 2
		imos[2 * k + 1] -= 2
	for i in range(3, 2 * k + 2):
		imos[i] += imos[i - 1]
	ans = 10 ** 18
	for i in range(2, 2 * k + 1):
		ans = min(ans, imos[i])
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		eo = [0 for i in range(n)]
		i = 0
		j = 2
		while i < n // 2:
			eo[i] = j
			eo[i + 1] = j + 2
			j += 6
			i += 2
		j = 1
		while i < n:
			eo[i] = j
			eo[i + 1] = j + 4
			j += 6
			i += 2
		print('YES')
		for i in range(n):
			print(eo[i], end=' ')
		print()


def Balanced_array(a):
	b = []
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		b.append(2)
		current = 2
		i = 1
		while i < a // 2:
			if i % 2 != 0:
				current += 2
			else:
				current += 4
			b.append(current)
			i += 1
		b.append(1)
		current = 1
		i = 1
		while i < a // 2:
			if i % 2 != 0:
				current += 4
			else:
				current += 2
			b.append(current)
			i += 1
	for i in b:
		print(i, end=' ')
n = int(input())
for i in range(n):
	arr = int(input())
	Balanced_array(arr)


import math
t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		cc = 2
		ss = 0
		for i in range(n // 2):
			ss += cc
			print(cc, end=' ')
			cc += 2
		cc = 1
		temp = 0
		for i in range(n // 2 - 1):
			print(cc, end=' ')
			temp += cc
			cc += 2
		print(ss - temp)
	else:
		print('NO')


t = int(input())
ans1 = [0] * t
ans2 = [0] * t
for j in range(t):
	n = int(input())
	if n % 4 == 2:
		ans1[j] = 0
	else:
		ans1[j] = 1
		ans2[j] = [0] * n
		for i in range(1, n // 2):
			ans2[j][i - 1] = i * 2
		ans2[j][n // 2 - 1] = n // 2 * 2
		for i in range(1, n // 2):
			ans2[j][i + n // 2 - 1] = i * 2 - 1
		ans2[j][n - 1] = n + n // 2 - 1
for i in range(t):
	if ans1[i] == 0:
		print('NO')
	else:
		print('YES')
		for j in range(len(ans2[i])):
			print(ans2[i][j], end=' ')
		print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	raj = dict()
	rang = []
	for i in range(n // 2):
		if raj.get(arr[i] + arr[n - i - 1]) == None:
			raj[arr[i] + arr[n - i - 1]] = 1
		else:
			raj[arr[i] + arr[n - i - 1]] += 1
		rang.append((min(arr[i], arr[n - i - 1]) + 1, max(arr[i], arr[n - i - 1]) + k))
	pre = [0] * (k * 2 + 2)
	for i in rang:
		pre[i[0]] += 1
		pre[i[1] + 1] -= 1
	for i in range(1, len(pre)):
		pre[i] = pre[i] + pre[i - 1]
	ans = float('inf')
	for i in range(2, k * 2 + 1):
		cnt = 0
		zero = 0
		if raj.get(i) != None:
			zero = raj[i]
		one = pre[i] - zero
		two = n // 2 - one - zero
		cnt = one + two * 2
		ans = min(ans, cnt)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	n_2 = n // 2
	if n_2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a1 = list(range(2, n + 1, 2))
		a2 = list(range(1, n, 2))
		a2[-1] += n_2
		print(' '.join(map(str, a1 + a2)))


MOD = 10 ** 9 + 7
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

def main():
	test = int(input())
	for iteration in range(test):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			ans = [0] * n
			even = 0
			for i in range(n // 2):
				ans[i] = i * 2 + 2
				even += i * 2 + 2
			odd = 0
			for i in range(n // 2 - 1):
				ans[n // 2 + i] = i * 2 + 1
				odd += i * 2 + 1
			ans[-1] = even - odd
			for j in ans:
				print(j, end=' ')
			print()
main()


a = int(input())
for i in range(a):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		for i in range(n // 2):
			ans.append(2 * (i + 1))
		for i in range(n // 2 - 1):
			ans.append(1 + 2 * i)
		one = sum(ans[0:n // 2])
		two = sum(ans[n // 2:])
		ans.append(one - two)
		print(' '.join(map(str, ans)))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	else:
		num = 2
		sumeven = 0
		print('YES')
		for j in range(0, n // 2):
			print(num, end=' ')
			sumeven += num
			num += 2
		num = 1
		sumodd = 0
		for j in range(0, n // 2 - 1):
			print(num, end=' ')
			sumodd += num
			num += 2
		print(sumeven - sumodd)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	lst = list()
	if not int(n / 2) % 2:
		for i in range(1, n + 1):
			if not i % 2:
				lst.append(i)
		for i in range(1, n + 1):
			if i % 2:
				lst.append(i)
		lst[len(lst) - 1] += int(n / 2)
	if not int(n / 2) % 2:
		print('YES')
		for i in range(len(lst)):
			print(lst[i], end=' ')
		print()
	else:
		print('NO')


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

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

def mdata():
	return map(int, data().split())
out = sys.stdout.write
for i in range(int(data())):
	n = int(data())
	if n % 4 != 0:
		print('NO')
	else:
		l1 = []
		l2 = []
		for i in range(1, n - 1, 2):
			l1.append(str(i))
			l2.append(str(i + 1))
		l1.append(str(n - 1 + n // 2))
		l2.append(str(n))
		s = ' '.join(l2) + ' ' + ' '.join(l1)
		print('YES')
		print(s)


import math as m

def f1():
	T = int(input())
	while T != 0:
		T = T - 1
		N = int(input())
		print(N / 3)

def f2():
	T = int(input())
	while T != 0:
		T = T - 1
		n = int(input())
		if n // 2 % 2 != 0:
			print('NO')
		else:
			E = [2 * i for i in range(1, n // 2 + 1)]
			O = [i for i in range(1, n - 1, 2)]
			se = sum(E)
			so = sum(O)
			O.append(se - so)
			print('YES')
			for i in E:
				print(i, end=' ')
			for i in O:
				print(i, end=' ')
			print()
f2()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum_even = 0
		sum_odd = 0
		for j in range(0, n // 2):
			sum_even = 2 * j + 2 + sum_even
			print(str(2 * j + 2), end=' ')
		for j in range(0, n // 2):
			sum_odd = 2 * j + 1 + sum_odd
			if j == n // 2 - 1:
				sum_diff = sum_even - sum_odd
				print(str(2 * j + 1 + sum_diff))
			else:
				print(str(2 * j + 1), end=' ')


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

def get_nums(n):
	first = list(range(2, n + 1, 2))
	second = list(range(1, n + 1, 2))
	res = first + second
	res[-1] += -sum(second) + sum(first)
	return res

def main():
	for _ in range(int(input())):
		(n,) = read_nums()
		if n % 4 != 0:
			print('NO')
		else:
			print('YES')
			print(' '.join(map(str, get_nums(n))))
main()


def max_overlap(start, end):
	n = len(start)
	start.sort()
	end.sort()
	inter = 1
	max_inter = 1
	i = 1
	j = 0
	while i < n and j < n:
		if start[i] <= end[j]:
			inter += 1
			if inter > max_inter:
				max_inter = inter
			i += 1
		else:
			inter -= 1
			j += 1
	return max_inter

def solution(A, n, k):
	arrl = []
	ext = []
	for i in range(n // 2):
		(x, y) = (A[i], A[-i - 1])
		arrl.append(1 + min(x, y))
		ext.append(k + max(x, y))
		arrl.append(x + y)
		ext.append(x + y)
	x = max_overlap(arrl, ext)
	return n - x
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	print(solution(A, n, k))


def solve(n, k, a):
	sol = n // 2
	intervals = {}
	start = 0
	for i in range(n // 2):
		(n1, n2, s) = (a[i], a[n - i - 1], a[i] + a[n - i - 1])
		lb = min(n1, n2) + 1
		ub = max(n1, n2) + k
		start += 2
		intervals[lb] = intervals.get(lb, 0) - 1
		intervals[s] = intervals.get(s, 0) - 1
		intervals[s + 1] = intervals.get(s + 1, 0) + 1
		intervals[ub + 1] = intervals.get(ub + 1, 0) + 1
	for t in range(2, 2 * k + 1):
		start += intervals.get(t, 0)
		sol = min(sol, start)
	return sol
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	print(solve(n, k, a))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	li = [0] * (2 * k)
	pref = [0] * (2 * k)
	c = []
	if n == 2:
		print(0)
		continue
	for i in range(n // 2):
		li[a[i] + a[-i - 1] - 1] += 1
	for i in range(n // 2):
		(x, y) = (a[i], a[-i - 1])
		range_min = min(x, y) + 1
		range_max = max(x, y) + k
		pref[range_min - 1] += 1
		if range_max <= 2 * k - 1:
			pref[range_max] -= 1
	for i in range(1, len(pref)):
		pref[i] += pref[i - 1]
	for i in range(2 * k):
		c.append(n - pref[i] - li[i])
	print(min(c))


def delitele(n):
	if n % 2 == 1:
		return False
	if n // 2 % 2 == 1:
		return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	if not delitele(n) or n == 2:
		print('NO')
	else:
		print('YES')
		res = list(range(2, n + 1, 2))
		res += list(range(1, n - 1, 2)) + [n + (n // 2 - 1)]
		print(' '.join(list(map(str, res))))


import math
a = []
for _ in range(int(input())):
	n = int(input())
	m = n // 2
	if m % 2 != 0:
		print('NO')
	else:
		even = []
		odd = []
		for i in range(1, m + 1):
			even.append(2 * i)
			if i <= m // 2:
				odd.append(2 * i - 1)
			else:
				odd.append(2 * i + 1)
		print('YES')
		print(*even, *odd)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		ans = list()
		s = 0
		print('YES')
		for i in range(0, int(n / 2)):
			print(2 * (i + 1), end=' ')
			s = s + 2 * (i + 1)
		for i in range(1, int(n / 2)):
			print(2 * i - 1, end=' ')
			s = s - (2 * i - 1)
		print(s)


def solve(n):
	if n % 4 != 0:
		return None
	else:
		ans = [2 * i for i in range(1, n // 2 + 1)]
		second = [2 * i + 1 if i < n // 2 - 1 else 2 * i + 1 + n // 2 for i in range(n // 2)]
		ans += second
		return ans
t = int(input())
for num in range(1, t + 1):
	n = int(input())
	answer = solve(n)
	if answer:
		print('YES')
		for i in answer:
			print(i, end=' ')
	else:
		print('NO')


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 collections import Counter
import heapq
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	d = {}
	pre = [0] * (2 * k + 2)
	for i in range(n // 2):
		if arr[i] + arr[n - i - 1] not in d:
			d[arr[i] + arr[n - i - 1]] = 1
		else:
			d[arr[i] + arr[n - i - 1]] += 1
		(x, y) = sorted([arr[i], arr[n - i - 1]])
		pre[x + 1] += 1
		pre[k + y + 1] -= 1
	for i in range(1, 2 * k + 1):
		pre[i] += pre[i - 1]
	mn = 1000000000.0
	for i in range(2, 2 * k + 1):
		var = pre[i]
		if i in d:
			var -= d[i]
		var += (n // 2 - pre[i]) * 2
		mn = min(mn, var)
	print(mn)


t = int(input())
while t:
	n = int(input())
	p = n // 2
	o = []
	e = []
	if p % 2 == 0:
		for i in range(1, p + 1):
			e.append(2 * i)
			o.append(2 * i - 1)
		o[len(o) - 1] = sum(e) - sum(o) + o[len(o) - 1]
		print('YES')
		print(*e + o)
	else:
		print('NO')
	t -= 1


t = int(input())
for tc in range(t):
	n = int(input())
	i = 2
	sup = 0
	if n % 4 != 0:
		print('No')
	else:
		print('YES')
		for k in range(n // 2):
			print(i, end=' ')
			sup += i
			i += 2
		k = n // 2 - 1
		i1 = 1
		sun = 0
		for j in range(k):
			print(i1, end=' ')
			sun += i1
			i1 += 2
		print(sup - sun)


from sys import stdin, stdout
from collections import deque
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		if n // 2 % 2 == 1:
			stdout.write('NO')
			stdout.write('\n')
			continue
		m = n // 2
		ans = deque([2, 1])
		for i in range(1, m):
			if i % 2 == 1:
				ans.appendleft(ans[0] + 2)
				ans.append(ans[-1] + 4)
			else:
				ans.appendleft(ans[0] + 4)
				ans.append(ans[-1] + 2)
		stdout.write('YES')
		stdout.write('\n')
		stdout.write(' '.join((str(x) for x in ans)))
		stdout.write('\n')
	stdout.close()
main()


import math
t = int(input())
for i in range(t):
	n = int(input())
	print('YES' if n % 4 == 0 else 'NO')
	if n % 4 == 0:
		j = 1
		for k in range(1, n // 4 + 1, 1):
			print(2 * j, 2 * (j + 1), end=' ')
			j += 3
		j = 1
		for k in range(1, n // 4 + 1, 1):
			print(2 * j - 1, 2 * (j + 2) - 1, end=' ')
			j += 3
		print()


t = int(input())
while t:
	t = t - 1
	n = int(input())
	if int(n / 2) % 2 != 0:
		print('NO')
	else:
		k = 100000
		a = 2
		print('YES')
		for x in range(int(n / 4)):
			print(2 * k - a, end=' ')
			a += 2
		a = 2
		for x in range(int(n / 4)):
			print(2 * k + a, end=' ')
			a += 2
		a = 1
		for x in range(int(n / 4)):
			print(2 * k - a, end=' ')
			a += 2
		a = 1
		for x in range(int(n / 4)):
			print(2 * k + a, end=' ')
			a += 2
		print()


for _ in range(int(input())):
	sum1 = 0
	sum2 = 0
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			sum1 += i
		for j in range(1, n - 1, 2):
			print(j, end=' ')
			sum2 += j
		print(sum1 - sum2)


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x & 1:
		print('NO')
	else:
		a = []
		start = 2
		total = 0
		for i in range(x):
			a.append(start)
			total += start
			start += 2
		t = 0
		start = 1
		for i in range(x - 1):
			a.append(start)
			t += start
			start += 2
		a.append(total - t)
		print('YES')
		print(' '.join(map(str, a)))


t = int(input())
for q in range(t):
	n = int(input())
	half = n // 2
	array = []
	evensum = 0
	odd = 1
	oddsum = 0
	if half % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
	for x in range(half):
		array.append(2 * (x + 1))
		evensum += 2 * (x + 1)
	for x in range(half):
		if x == half - 1:
			array.append(evensum - oddsum)
			break
		array.append(odd)
		oddsum += odd
		odd += 2
	for x in array:
		print(x, end=' ')
	print()


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n * (n + 1) // 2 % 2 == 0:
		arr = []
		for i in range(n // 2):
			arr.append(2 * (i + 1))
		sumarr = sum(arr)
		summ = 0
		for i in range(1, n - 1):
			if i % 2 != 0:
				arr.append(i)
				summ += i
		arr.append(sumarr - summ)
		print('YES')
		print(*arr)
	else:
		print('NO')


item = []
for i in range(int(input())):
	balance = int(input())
	if balance % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(2, balance + 1, 2):
			print(j, end=' ')
		for k in range(1, balance // 2, 2):
			print(k, end=' ')
		for m in range(balance // 2 + 3, balance + 2, 2):
			print(m, end=' ')
		print()


from collections import Counter
t = int(input())
for i in range(t):
	(n, k) = (int(x) for x in input().split())
	a = list(map(int, input().split()))
	pairs = n // 2
	p = [(a[i], a[n - i - 1]) for i in range(pairs)]
	sump = [sum(x) for x in p]
	pc = Counter(sump)
	minp = [min(x) + 1 for x in p]
	maxp = [max(x) + k for x in p]
	ans = float('inf')
	imos = [0] * (max(maxp) + 2)
	cs = [imos[0]]
	for i in range(pairs):
		imos[minp[i]] += 1
		imos[maxp[i] + 1] -= 1
	for i in range(1, len(imos)):
		cs.append(cs[i - 1] + imos[i])
	for i in range(min(minp), max(maxp) + 1):
		s = cs[i]
		c = pc[i]
		ans = min(ans, (pairs - s) * 2 + s - c)
	print(ans)


import math
a = int(input())
for i in range(a):
	n = int(input())
	n1 = math.trunc(n // 2)
	a1 = []
	a2 = []
	for i in range(1, math.trunc(n / 2) + 1):
		a1.append(i * 2)
		a2.append(i * 2 - 1)
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		aq = sum(a1) - sum(a2)
		a2[len(a2) - 1] += aq
		for g in a1:
			print(str(g) + ' ', end='')
		for h in a2:
			print(str(h) + ' ', end='')
		print()


def op():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return 0
	a = []
	b = []
	e = 2
	for i in range(n // 4):
		a.append(e)
		b.append(e - 1)
		e += 2
		a.append(e)
		b.append(e + 1)
		e += 4
	print('YES')
	for i in a:
		print(i, end=' ')
	for i in b:
		print(i, end=' ')
	print('')
	return 0
n = int(input())
for i in range(n):
	op()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n % 4 != 0:
		print('NO')
	else:
		out = [0] * n
		for i in range(n // 2):
			out[i] = (i + 1) * 2
		for i in range(n // 2, n // 2 + n // 4):
			out[i] = out[i - n // 2] - 1
		for i in range(n // 2 + n // 4, n):
			out[i] = out[i - n // 2] + 1
		print('YES')
		print(*out)


for _ in range(int(input())):
	n = int(input())
	l = n // 2
	if l % 2 != 0:
		print('NO')
		continue
	print('YES')
	s = 0
	for i in range(l):
		s += 2 * (i + 1)
		print(2 * (i + 1), end=' ')
	for i in range(l - 1):
		s -= 2 * (i + 1) - 1
		print(2 * (i + 1) - 1, end=' ')
	print(s, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	l = n // 2
	if l % 2 != 0:
		print('NO')
		continue
	even = [2 * (i + 1) for i in range(l)]
	odd = [1 + 2 * i for i in range(l - 1)]
	result = even + odd + [sum(even) - sum(odd)]
	print('YES')
	print(*result)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		l1 = [2 * x for x in range(1, int(n / 2 + 1))]
		l2 = [2 * i + 1 for i in range(int(n / 2))]
		l2[-1] += int(n / 2)
		l = l1 + l2
		l = [str(x) for x in l]
		print('YES')
		print(' '.join(l))
	else:
		print('NO')


def balArray(n):
	if n // 2 % 2 != 0:
		print('NO')
	else:
		e = []
		o = []
		for i in range(2, n + 2, 2):
			e.append(i)
		for j in range(len(e)):
			o.append(e[j] - 1)
		o[-1] += len(e)
		print('YES')
		print(*e + o)
tc = int(input())
for i in range(tc):
	n = int(input())
	balArray(n)


t = int(input())
while t > 0:
	inp = int(input())
	if inp % 4 == 2:
		print('NO')
	else:
		print('YES')
		arr = []
		sum_even = 0
		for i in range(int(inp / 2)):
			arr.append(2 * i + 2)
			sum_even += 2 * i + 2
		sum_odd = 0
		for i in range(int(inp / 2) - 1):
			arr.append(2 * i + 1)
			sum_odd += 2 * i + 1
		arr.append(sum_even - sum_odd)
		for i in range(inp):
			print(arr[i], end=' ')
		print()
	t -= 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for j in range(1, n - 1, 2):
			print(j, end=' ')
		print(n + n // 2 - 1)
	else:
		print('NO')


for i in range(int(input())):
	num = int(input())
	if num % 4 == 0:
		print('YES')
		firstHalf = [x + 2 for x in range(num) if x % 2 == 0]
		almostFH = firstHalf[:-1]
		secondHalf = [x - 1 for x in almostFH]
		secondHalf.insert(0, sum(firstHalf) - sum(secondHalf))
		print(*firstHalf + secondHalf)
	else:
		print('NO')


t = input()
testcase = int(t)
for i in range(testcase):
	s = input()
	n = int(s)
	even = []
	odd = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	evenSum = sum(even)
	oddSum = sum(odd)
	temp = evenSum - oddSum
	if (odd[len(odd) - 1] + temp) % 2 != 0:
		print('YES')
		for i in even:
			print(i, end=' ')
		odd[len(odd) - 1] += temp
		for i in odd:
			print(i, end=' ')
	else:
		print('NO')


from sys import stdin

def solve(n):
	(even, odd) = (list(), list())
	nums = set()
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		(i, _sum) = (2, 0)
		for _ in range(n // 2):
			even.append(i)
			_sum += i
			i += 2
		i = 1
		for k in range(n // 2):
			if k + 1 == n // 2:
				assert _sum % 2 != 0
				odd.append(_sum)
			else:
				odd.append(i)
			i += 2
			_sum -= odd[-1]
		print(*even + odd)

def main():
	t = int(stdin.readline().strip())
	for _ in range(t):
		n = int(stdin.readline().strip())
		solve(n)
main()


test = int(input())
for i in range(test):
	n = int(int(input()))
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print((i + 1) * 2, end=' ')
		print('1', end=' ')
		val = 1
		for i in range(1, n // 2 - 1):
			val = val + 2
			print(val, end=' ')
		val = val + 2 + n // 2
		print(val)


testcases = int(input())
l = []
for _ in range(testcases):
	n = int(input())
	l.append(n)
for i in l:
	if i // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l2 = []
		c = 2
		for j in range(i // 2):
			l2.append(c)
			c += 2
		k = sum(l2)
		c = 1
		for j in range(i // 2 - 1):
			l2.append(c)
			c += 2
		p = sum(l2[i // 2:])
		l2.append(k - p)
		for j in l2:
			print(j, end=' ')
		print()


t = int(input())
while t != 0:
	s = int(input())
	d = s // 2
	if d % 2 == 0:
		print('YES')
		for j in range(2, s + 1, 2):
			print(j, end=' ')
		for j in range(1, s - 1, 2):
			print(j, end=' ')
		print(j + s // 2 + 2, end=' ')
		print('\t')
	else:
		print('NO')
	t = t - 1


n = int(input())
for i in range(n):
	number = int(input())
	even_list = []
	odd_list = []
	number_list = list(range(1, number + 2))
	for j in range(number):
		if number_list[j] % 2 == 0:
			even_list.append(number_list[j])
		elif number_list[j] % 2 != 0:
			odd_list.append(number_list[j])
	difference = sum(even_list) - sum(odd_list)
	odd_list[-1] += difference
	if odd_list[-1] % 2 == 0:
		print('NO')
	else:
		print('YES')
		print(str(even_list).strip(',[]').replace(',', ''), str(odd_list).strip(',[]').replace(',', ''))


import sys
import math
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())
	count = 2
	flag = 0
	temp = [0] * n
	if n // 2 % 2 == 0:
		for i in range(n // 2):
			if flag % 2 == 0:
				temp[i] = count
				temp[n - 1 - i] = count - 1
			else:
				temp[i] = count
				temp[n - 1 - i] = count + 1
			flag += 1
			count += 4
		print('YES')
		print(*temp, sep=' ')
	else:
		print('NO')


n = int(input())
ns = []
for i in range(0, n):
	ns.append(int(input()))

def yes(a):
	a = int(a)
	arr = []
	sm = 0
	for i in range(0, int(a / 2)):
		print((i + 1) * 2, end=' ')
		sm = sm + (i + 1) * 2
	for i in range(0, int(a / 2) - 1):
		print(i * 2 + 1, end=' ')
		sm = sm - (i * 2 + 1)
	print(sm)
for i in ns:
	a = i
	if a % 4 == 0:
		print('YES')
		yes(a)
	else:
		print('NO')


def solve(a, k):
	half = len(a) // 2
	buckets = [0 for x in range(2 * (k + 2))]
	for i in range(half):
		min_value = min(a[i], a[~i])
		max_value = max(a[i], a[~i])
		buckets[1] += 2
		buckets[min_value + 1] -= 1
		buckets[min_value + max_value] -= 1
		buckets[min_value + max_value + 1] += 1
		buckets[max_value + k + 1] += 1
	curr = 0
	result = 99999999999999999999
	for i in buckets[1:]:
		curr += i
		result = min(result, curr)
	return result
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	print(solve(a, k))


n = int(input())
for i in range(n):
	t = int(input())
	if t / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = []
		b = []
		for k in range(1, int(t / 2 + 1)):
			a.append(2 * k)
			b.append(2 * k - 1)
		b[-1] = sum(a) - sum(b) + b[-1]
		c = a + b
		for elem in c:
			print(elem, end=' ')


from sys import stdin
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n // 2 % 2 == 0:
		print('YES')
		for j1 in range(1, n // 2 + 1):
			print(2 * j1, end=' ')
		for j1 in range(1, n // 2 // 2 + 1):
			print(2 * j1 - 1, end=' ')
		for j1 in range(n // 2 // 2 + 1, n // 2 + 1):
			print(2 * j1 + 1, end=' ')
		print('')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	array1 = [2, 4]
	array2 = [1, 5]
	if n // 2 % 2 != 0:
		print('NO')
	else:
		list1 = [0] * n
		print('YES')
		try:
			for i in range(0, n // 2, 2):
				list1[i] = array1[0]
				list1[i + 1] = array1[1]
				for j in range(2):
					array1[j] = array1[j] + 6
			for i in range(n // 2, n, 2):
				list1[i] = array2[0]
				list1[i + 1] = array2[1]
				for j in range(2):
					array2[j] = array2[j] + 6
		except IndexError:
			pass
		finally:
			for i in list1:
				print(i, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	s = 0
	if n / 2 % 2 != 0:
		print('NO')
	else:
		m = int(n / 2)
		print('YES')
		for i in range(2, 2 * m + 1, 2):
			print(i, end=' ')
		for j in range(2, 2 * m, 2):
			print(j - 1, end=' ')
			s = s + 1
		print(2 * m + s)


T = int(input())
for tc in range(T):
	n = int(input())
	if n % 4:
		print('NO')
		continue
	else:
		print('YES')
		tmp = 0
		s = 0
		for i in range(n // 2):
			tmp += 2
			s += tmp
			print(tmp, end=' ')
		tmp = -1
		d = 0
		for i in range(n // 2 - 1):
			tmp += 2
			d += tmp
			print(tmp, end=' ')
		print(s - d)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
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
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

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)]
for _ in range(int(data())):
	n = int(data())
	if n % 4 == 0:
		outln('YES')
		(even, odd) = (deque(), deque())
		for i in range(1, n // 2 + 1):
			even.append(2 * i)
		temp = even[0] + even[-1]
		t = 1
		for i in range(1, n // 4 + 1):
			odd.appendleft(t)
			odd.append(temp - t)
			t += 2
		odd = list(odd)
		odd.sort()
		even.extend(odd)
		print(*even)
		continue
	outln('NO')


def solve():
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		return
	print('YES')
	s = 0
	evenarr = []
	oddarr = []
	for j in range(n // 2):
		s += 2
		evenarr.append(s)
		oddarr.append(s - 1)
	oddarr.pop(-1)
	oddarr.append(sum(evenarr) - sum(oddarr))
	ans = evenarr + oddarr
	print(' '.join((str(v) for v in ans)))
t = int(input())
for _ in range(t):
	solve()


def main():
	for _ in range(int(input())):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			j = 2
			arr = list()
			s = 0
			for i in range(n // 2):
				s += j
				arr.append(j)
				j += 2
			j = 1
			for i in range(n // 2 - 1):
				s -= j
				arr.append(j)
				j += 2
			arr.append(s)
			for i in range(n):
				print(arr[i], end=' ')
			print()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		cur = 2
		ans = []
		for i in range(n // 2):
			ans.append(cur)
			cur += 2
		cur = 1
		for i in range(n // 4):
			ans.append(cur)
			cur += 2
		cur = n + 1
		for i in range(n // 4):
			ans.append(cur)
			cur -= 2
		print('YES')
		print(*ans)


for i in range(int(input())):
	number = int(input())
	if number % 4 == 2:
		print('NO')
	else:
		print('YES')
		for j in range(1, number // 4 + 1):
			print(number // 2 + number // 2 + 2 - j * 2, j * 2, end=' ')
		for j in range(1, number // 4 + 1):
			print(number // 2 - j * 2 + 1 + number // 2 + 2, j * 2 - 1, end=' ')
		print()


for _ in range(0, int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = [2 * i for i in range(1, n // 2 + 1)]
		b = []
		k = 1
		for _ in range(1, n // 2):
			b.append(k)
			k += 2
		b.append(sum(a) - sum(b))
		if sum(a) == sum(b):
			print('YES')
			for i in a + b:
				print(i, end=' ')
		print()


from sys import stdin
a = int(stdin.readline())
for k in range(0, a):
	b = int(stdin.readline())
	if b % 4 != 0:
		print('NO')
	else:
		print('YES')
		u = int(b / 4)
		for t in range(1, int(b / 2) + 1):
			print(2 * t, end=' ')
		for r in range(0, int(b / 4)):
			print(1 + 2 * r, end=' ')
		for q in range(int(b / 4), int(b / 2)):
			if q == int(b / 2) - 1:
				print(3 + 2 * q)
			else:
				print(3 + 2 * q, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		a1 = range(2, n + 1, 2)
		a2 = range(1, n - 1, 2)
		a3 = sum(a1) - sum(a2)
		a = list(map(str, a1)) + list(map(str, a2)) + [str(a3)]
		print('YES')
		print(' '.join(a))


t = int(input())
while t:
	n = int(input())
	A = []
	for i in range(1, n + 1):
		A.append(i)
	Ev = []
	Od = []
	for i in range(len(A)):
		if A[i] % 2 == 0:
			Ev.append(A[i])
		else:
			Od.append(A[i])
	c = Ev + Od
	d = sum(Ev)
	e = sum(Od)
	if d == e:
		print('YES')
		for i in c:
			print(i, end=' ')
	else:
		dif = abs(d - e)
		if dif % 2 != 0:
			print('NO')
		else:
			c[-1] = c[-1] + dif
			print('YES')
			for i in c:
				print(i, end=' ')
	t -= 1


t = int(input())
ans = []
seqs = []
for _ in range(0, t):
	n = int(input())
	if n // 2 % 2 == 0:
		ans.append('YES')
		seq = []
		i = 2
		s1 = 0
		while i <= n:
			seq.append(i)
			s1 += i
			i += 2
		i = 1
		s2 = 0
		while i <= n - 3:
			seq.append(i)
			s2 += i
			i += 2
		seq.append(s1 - s2)
		seqs.append(seq)
	else:
		ans.append('NO')
j = 0
for i in range(0, len(ans)):
	print(ans[i])
	if ans[i] == 'YES':
		for _ in range(0, len(seqs[j])):
			print(seqs[j][_], end=' ')
		print()
		j += 1


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		j = n // 2
		evn = 2
		odd = 1
		sum1 = 0
		sum2 = 0
		for k in range(j):
			print(evn, end=' ')
			sum1 = sum1 + evn
			evn = evn + 2
		for k in range(j):
			if k != j - 1:
				print(odd, end=' ')
				sum2 = sum2 + odd
				odd = odd + 2
			else:
				print(sum1 - sum2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		res = [0] * n
		for j in range(n // 2):
			res[j] = 2 * j + 2
		for j in range(n // 2, n - 1):
			res[j] = 2 * (j - n // 2) + 1
		res[n - 1] = 3 * (n // 2) - 1
		s = ''
		for r in res:
			s += str(r) + ' '
		print(s)


import sys
import math
input = sys.stdin.buffer.readline
ans = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	freq = [0] * (2 * k + 2)
	maxPosVal = [0] * (2 * k + 2)
	minPosVal = [0] * (2 * k + 2)
	for i in range(n // 2):
		maxPosVal[k + max(a[i], a[n - i - 1])] += 1
		minPosVal[1 + min(a[i], a[n - i - 1])] += 1
		freq[a[i] + a[n - i - 1]] += 1
	for i in range(k, 1, -1):
		minPosVal[i] = minPosVal[i + 1] + minPosVal[i]
	for i in range(k + 1, 2 * k + 1):
		maxPosVal[i] = maxPosVal[i - 1] + maxPosVal[i]
	minCount = n // 2
	for i in range(2, 2 * k + 1):
		x = n // 2 - freq[i] + minPosVal[i + 1] + maxPosVal[i - 1]
		minCount = min(minCount, x)
	ans.append(minCount)
print('\n'.join(map(str, ans)))


test = int(input())
while test:
	test -= 1
	query = int(input())
	num1 = 0
	num2 = 0
	if query / 2 % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		loop = int(query / 2)
		for i in range(loop):
			num1 = num1 + (i + 1) * 2
			print((i + 1) * 2, end=' ')
		for i in range(loop - 1):
			num2 = num2 + i * 2 + 1
			print(i * 2 + 1, end=' ')
		print(num1 - num2)


def force(n):
	a = n
	if a / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		b = int(a / 2)
		c = [i for i in range(2, a + 1, 2)]
		d = [i for i in range(1, a, 2)]
		if sum(d) < sum(c):
			d[-1] += sum(c) - sum(d)
		print(' '.join([str(i) for i in c + d]))
rep = int(input())
for i in range(rep):
	test = int(input())
	force(test)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

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

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

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))
for i in range(inp()):
	(n, k) = inpl()
	a = inpl()
	imo = [0] * (2 * k + 100)
	cnt = defaultdict(int)
	for i in range(n // 2):
		(l, r) = (a[i], a[-i - 1])
		if l > r:
			(l, r) = (r, l)
		cnt[l + r] += 1
		imo[l + 1] += 1
		imo[k + r + 1] -= 1
	imo = list(itertools.accumulate(imo))
	res = INF
	for (i, x) in enumerate(imo):
		ans = x + (n // 2 - x) * 2 - cnt[i]
		res = min(res, ans)
	print(res)


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	a = [0 for i in range(n)]
	a[0] = 2
	a[-1] = 1
	for i in range(1, n // 2):
		a[i] = a[i - 1] + 2
		if i == n // 2 - 1:
			a[n // 2] = (2 + a[i]) * n // 2 // 2 - (1 + a[-i]) * (n // 2 - 1) // 2
			print(*a)
			break
		a[-i - 1] = a[-i] + 2


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		chet = [i * 2 for i in range(1, n // 2 + 1)]
		nechet = [i - 1 for i in chet]
		nechet[-1] = (2 + chet[-1]) // 2 * (n // 2) - (1 + nechet[-2]) // 2 * (n // 2 - 1)
		print(*chet, *nechet)


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		k = n // 2
		i = 1
		j = 2
		se = 0
		while i <= k:
			se += j
			print(j, end=' ')
			i += 1
			j += 2
		j = 1
		so = 0
		while i < n:
			so += j
			print(j, end=' ')
			j += 2
			i += 1
		print(abs(se - so))
	else:
		print('NO')


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
s = sum
t = iinp()
for _ in range(t):
	n = iinp()
	tmp = n // 2
	if tmp % 2 != 0:
		print('NO')
	else:
		print('YES')
		par = [i for i in range(2, tmp * 2 + 1, 2)]
		impar = [i for i in range(1, (tmp - 1) * 2, 2)]
		impar.append(s(par) - s(impar))
		print(*par, end=' ')
		print(*impar)


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


t = int(input())
for i in range(t):
	p = int(input())
	even = 2
	odd = 1
	s = 0
	z = 0
	a = []
	for j in range(int(p / 2)):
		a.append(even)
		s += even
		even += 2
	for j in range(int(p / 2), p - 1):
		a.append(odd)
		z += odd
		odd += 2
	if (s - z) % 2 != 0 and s - z > odd:
		a.append(s - z)
		print('YES')
		print(*a)
	else:
		print('NO')


import math
import sys
from collections import defaultdict
from collections import Counter
from collections import deque
import bisect
from itertools import accumulate
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)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
for _ in range(int(input())):
	(n, k) = ilele()
	A = alele()
	B = []
	mark = {}
	mins = [0] * (2 * k + 2)
	maxs = mins.copy()
	for i in range(n // 2):
		x = A[i]
		y = A[n - i - 1]
		mark[x + y] = mark.get(x + y, 0) + 1
		if x > y:
			(x, y) = (y, x)
		mins[x + 1] += 1
		maxs[y + k + 1] += 1
	v = 0
	Ans = n // 2
	for i in range(len(mins)):
		v += mins[i] - maxs[i]
		if i in mark:
			one = v - mark[i]
			two = n // 2 - v
			sw = one + 2 * two
			Ans = min(Ans, sw)
	print(Ans)


t = int(input())
for j in range(t):
	n = int(input())
	check = 0
	a = []
	b = []
	if n % 4 != 0:
		check = 1
	else:
		check = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				b.append(int(i))
			else:
				a.append(int(i))
		x = len(a)
		a[x - 1] = int(a[x - 1] + n / 2)
		l = b + a
	if check == 1:
		print('NO')
	else:
		print('YES')
		print(*l, sep=' ')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	cnt = [0] * (2 * k + 2)
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		z = sorted([a[i], a[n - i - 1]])
		cnt[sum(z)] += 1
		pref[z[0] + 1] += 1
		pref[z[1] + k + 1] -= 1
	for i in range(1, len(pref)):
		pref[i] += pref[i - 1]
	ans = 10 ** 10
	for i in range(2, len(pref)):
		ans = min(ans, pref[i] - cnt[i] + (n // 2 - pref[i]) * 2)
	print(ans)


for i in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		head = [x for x in range(1, n + 1) if x % 2 == 0]
		tail = [x for x in range(1, n - 1) if x % 2 == 1]
		tail.append(len(head) + tail[-1] + 2)
		print(*head, *tail)


def calc(n):
	(a, b, sum2) = (2, 1, 0)
	l = []
	for i in range(n // 2):
		l.append(a)
		a += 2
	sum1 = sum(l)
	for i in range(n // 2 - 1):
		l.append(b)
		sum2 = sum2 + b
		b += 2
	l.append(sum1 - sum2)
	return ' '.join((str(x) for x in l))
try:
	t = int(input())
	for i in range(t):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			print(calc(n))
except:
	pass


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	shift = 4
	to_print = 2
	for i in range(n // 2):
		print(to_print, end=' ')
		to_print += shift
		shift = 6 - shift
	shift = 2
	to_print = 3
	for i in range(n // 2):
		print(to_print, end=' ')
		to_print += shift
		shift = 6 - shift
	print()


for _ in range(int(input())):
	n = int(input())
	c = n * (n + 1) // 2
	if c % 2 != 0:
		print('NO')
	else:
		l1 = []
		l2 = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				l1.append(i)
		for i in range(1, n - 1):
			if i % 2 != 0:
				l2.append(i)
		s = sum(l1) - sum(l2)
		l2.append(s)
		print('YES')
		print(*l1, *l2)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		i = 2
		while len(a) < n // 2:
			a.append(i)
			a.append(i + 2)
			i += 6
		i = 1
		while len(a) < n:
			a.append(i)
			a.append(i + 4)
			i += 6
		print(*a)


def get_answer(n):
	m = n // 2
	if m % 2 != 0:
		return []
	result = []
	for i in range(1, m + 1):
		result.append(2 * i)
	for i in range(1, m):
		result.append(2 * i - 1)
	result.append(2 * m - 1 + m)
	return result
t = int(input())
for _ in range(t):
	n = int(input())
	a = get_answer(n)
	if not a:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, a)))


t = int(input())

def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	odds = []
	evens = []
	for i in range(1, n + 2):
		if i == n // 2 + 1:
			continue
		if i % 2 == 0:
			evens.append(i)
		else:
			odds.append(i)
	print('YES')
	ans = evens + odds
	print(*ans)
li = []
for _ in range(t):
	li.append(int(input()))
for i in li:
	solve(i)


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')

def print(val):
	sys.stdout.write(str(val) + '\n')

def yo():
	for _ in range(int(input().strip())):
		(n, k) = map(int, input().split())
		nums = list(map(int, input().split()))
		common_values = [0 for _ in range(2 * k + 2)]
		for i in range(n // 2):
			(a, b) = (nums[i], nums[n - 1 - i])
			common_values[a + b - max(a, b) + 1] -= 1
			common_values[a + b] -= 1
			common_values[a + b + 1] += 1
			common_values[a + b - min(a, b) + k + 1] += 1
		common_values[1] = n
		minimum = n
		for i in range(2, 2 * k + 1):
			common_values[i] += common_values[i - 1]
			minimum = min(minimum, common_values[i])
		print(minimum)
yo()


T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		tot = n // 2
		print('YES')
		for i in range(tot):
			print(2 * (i + 1), end=' ')
		for i in range(tot - 1):
			print(2 * i + 1, end=' ')
		print(2 * i + 3 + tot)


case = int(input())
for i in range(case):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		mid = (n + 2) // 2
		top = n + 2
		ans = ''
		for j in range(mid - 1):
			ans += str(2 * j + 2) + ' '
		for k in range(mid):
			if 2 * k + 1 == mid:
				pass
			else:
				ans += str(2 * k + 1) + ' '
		print(ans.rstrip(' '))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		se = 0
		so = 0
		e = 2
		o = 1
		for i in range(n // 2):
			print(e, end=' ')
			se += e
			e += 2
		for i in range(n // 2 - 1):
			print(o, end=' ')
			so += o
			o += 2
		print(se - so)
	else:
		print('NO')


n = int(input())
liso = []
lise = []
for i in range(n):
	a = int(input())
	liso.clear()
	lise.clear()
	x = a / 2
	p = 0
	q = 0
	sumeven = 0
	sumodd = 0
	if x % 2 != 0:
		print('No')
	else:
		for j in range(2, 100000000, 2):
			if p == x:
				break
			else:
				lise.append(j)
				p += 1
		aaa = sum(lise)
		for k in range(1, 100000000, 2):
			if q == x - 1:
				liso.append(aaa - sum(liso))
				break
			else:
				liso.append(k)
				q += 1
		print('Yes')
		w = lise + liso
		print(*w, sep=' ')


for i in [0] * int(input()):
	i = int(input())
	if i / 2 % 2 == 0:
		t = sum((a for a in range(2, i + 1, 2)))
		l = [z for z in range(2, i + 1, 2)]
		x = l[-2]
		l1 = [p for p in range(1, x, 2)]
		y = sum((p for p in range(1, x, 2)))
		l2 = l + l1
		print('YES')
		print(' '.join(map(str, l2)) + ' ' + str(t - y))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if int(n / 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for x in range(2, n + 1, 2):
			l.append(x)
		for y in range(0, n // 2):
			if y == n // 2 - 1:
				l.append(l[y] + (n // 2 - 1))
			else:
				l.append(l[y] - 1)
		print(*l)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		ans = []
		k = 0
		summ = 0
		for i in range(n // 2):
			k += 2
			ans.append(k)
			summ += k
		oddsum = 0
		k = -1
		for i in range(n // 2 - 1):
			k += 2
			ans.append(k)
			oddsum += k
		ans.append(summ - oddsum)
		print('YES')
		print(' '.join([str(x) for x in ans]))


def solve_case():
	n = int(input())
	n //= 2
	if n % 2 == 1:
		return 'NO'
	m = n // 2
	ans = []
	cur = 2
	s = 0
	for _ in range(n):
		ans.append(cur)
		s += cur
		cur += 2
	cur = 1
	for _ in range(n - 1):
		ans.append(cur)
		s -= cur
		cur += 2
	ans.append(s)
	return 'YES\n{}'.format(' '.join(map(str, ans)))

def main():
	tests = int(input())
	for t in range(1, tests + 1):
		print(solve_case())
main()


list1 = []
for a in range(1, 10 ** 6 + 4):
	list1.append(2 * a)
list2 = []
for a in range(1, 10 ** 6 + 4, 2):
	list2.append(a)
a = int(input())
for _ in range(a):
	(list3, list4) = ([], [])
	b = int(input())
	if b // 2 % 2 != 0:
		print('NO')
	else:
		for d in range(b // 2):
			list3.append(list1[d])
		for d in range(b // 2 - 1):
			list4.append(list2[d])
		x = sum(list3) - sum(list4)
		print('YES')
		for d in list3:
			print(d, end=' ')
		for d in list4:
			print(d, end=' ')
		print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		mid = int(n / 2)
		ar1 = [2 * x for x in range(1, mid + 1)]
		ar2 = [2 * x + 1 for x in range(0, mid - 1)]
		last = sum(ar1) - sum(ar2)
		ar3 = ar1 + ar2
		ar3.append(last)
		print(*ar3)


n = int(input())
for i in range(n):
	n = int(input())
	n2 = n // 2
	if n2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		t = [2 * (i + 1) for i in range(n2)]
		v = sum(t)
		for i in range(n2 - 1):
			v -= 2 * i + 1
			t.append(2 * i + 1)
		t.append(v)
		print(*t, sep=' ')


for i in range(int(input())):
	a = int(input())
	o = a // 2
	e = a // 2
	if o % 2 != 0:
		print('NO')
	elif o % 2 == 0:
		if o == 1:
			print('NO')
		else:
			o = []
			e = []
			x = 0
			for k in range(a // 2):
				if k < a // 2 - 1:
					if k == 0:
						o.append(1)
						e.append(2)
					else:
						o.append(o[-1] + 2)
						e.append(e[-1] + 2)
			e.append(e[-1] + 2)
			o.append(sum(e) - sum(o))
			print('YES')
			print(*e + o)


t = int(input())
for q in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	even = []
	odd = []
	dif1 = 0
	dif2 = 0
	for i in range(1, n - 1):
		if i % 2 == 0:
			even.append(i)
			dif1 += i
		else:
			odd.append(i)
			dif2 += i
	even.append(n)
	odd.append(dif1 + n - dif2)
	print('YES')
	for i in range(n // 2):
		print(even[i], end=' ')
	for i in range(n // 2):
		print(odd[i], end=' ')
	print()


t1 = int(input())
for x in range(t1):
	(n, k) = map(int, input().split())
	t = list(map(int, input().split()))
	el_sum = [0] * (2 * k + 2)
	for y in range(0, n // 2):
		l = t[y]
		r = t[n - y - 1]
		el_sum[0] += 2
		el_sum[l + r] -= 1
		el_sum[l + r + 1] += 1
		el_sum[min(l, r) + 1] -= 1
		el_sum[max(l, r) + k + 1] += 1
	for y in range(2 * k + 1):
		el_sum[y + 1] += el_sum[y]
	print(min(el_sum))


t = int(input())
for _ in range(t):
	n = int(input())
	L = []
	if n % 4 != 0:
		print('NO')
		continue
	else:
		L = [2 * k for k in range(1, n // 2 + 1)]
		for b in range(1, n // 4 + 1):
			L.append(2 * b - 1)
		for d in range(n // 4 + 1, n // 2 + 1):
			L.append(2 * d + 1)
	print('YES')
	for v in L:
		print(v, end=' ')
	print('\n')


number_test = int(input())
for k in range(number_test):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		m = n // 2
		P = [2 * (k + 1) for k in range(m)]
		I = [2 * (j + 1) - 1 for j in range(m - 1)] + [2 * (m - 1) + m + 1]
		sol = P + I
		sol = ' '.join(map(str, sol))
		print('YES')
		print(sol)


def res(n):
	return n % 4 == 0
n = int(input())
for i in range(n):
	k = int(input())
	if res(k):
		print('YES')
		l = 2
		for h in range(0, k // 2):
			print(l, end=' ')
			l += 2
		l = 1
		for h in range(0, k // 2):
			if h != k // 2 - 1:
				print(l, end=' ')
				l += 2
			else:
				print(l + k // 2)
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	arr1 = []
	arr2 = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(1, n + 1):
			if j % 2 == 0:
				arr1.append(j)
			else:
				arr2.append(j)
		arr2[-1] = arr2[-1] + int(n / 2)
		for k in arr1:
			print(k, end=' ')
		for l in arr2:
			print(l, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		tmp = n // 2
		start = 4
		start_odd = 3
		for i in range(tmp):
			a.append(start)
			start += 2
		for i in range(tmp - 1):
			a.append(start_odd)
			start_odd += 2
		a.append(start_odd + tmp)
		for i in range(n):
			print(a[i], end=' ')
			if i == n - 1:
				print('\n', end='')


for i in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		evens = [x for x in range(2, n + 1, 2)]
		odds = []
		od = 1
		for i in range(int(n / 2) - 1):
			odds.append(od)
			od += 2
		odds.append(sum(evens) - sum(odds))
		evens = evens + odds
		s = ''
		for i in evens:
			s += str(i) + ' '
		print(s[:-1])


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		left_a = list(range(2, n + 1, 2))
		right_a = list(range(1, n - 1, 2))
		rem = sum(left_a) - sum(right_a)
		print(*left_a, *right_a, rem)
	else:
		print('NO')


k = int(input())
for i in range(k):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	n2 = int(n / 2)
	result = [x for x in range(2, n2 * 2 + 1, 2)]
	result2 = [x - 1 for x in result]
	result2[-1] = sum(result) - sum(result2[:-1])
	print(' '.join(map(str, result + result2)))


def foo(n, data, k):
	farr = [0] * (2 * k + 1)
	sarr = [0] * (2 * k + 2)
	i = 0
	while i < n // 2:
		farr[data[i] + data[size - i - 1]] += 1
		i += 1
	i = 0
	while i < n // 2:
		sarr[min(data[i], data[size - i - 1]) + 1] += 1
		sarr[max(data[i], data[size - i - 1]) + k + 1] -= 1
		i += 1
	i = 1
	while i < 2 * k + 1:
		sarr[i] += sarr[i - 1]
		i += 1
	i = 0
	minimum = int(2 * 1000000.0)
	while i <= k * 2:
		minimum = min(minimum, sarr[i] - farr[i] + 2 * (n // 2 - sarr[i]))
		i += 1
	print(minimum)
test = int(input())
while test:
	(size, k) = [int(x) for x in input().split()]
	data = [int(i) for i in input().split()]
	foo(size, data, k)
	test -= 1


import sys

def process(n):
	n1 = n // 2
	if n1 % 2 != 0:
		print('NO')
		return
	print('YES')
	list1 = [2 * i for i in range(1, n1 + 1)]
	list2 = [2 * i - 1 for i in range(1, n1)]
	last = sum(list1) - sum(list2)
	list2.append(last)
	r = ''
	first = True
	for a in list1:
		if first:
			r += str(a)
			first = False
		else:
			r += ' ' + str(a)
	for a in list2:
		r += ' ' + str(a)
	print(r)
input = sys.stdin.readline

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

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

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

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

def f(a, n):
	return True

def is_permutation(arr):
	for e in range(1, len(arr) + 1):
		if e not in arr:
			return False
	return True
t = inp()
for i in range(t):
	n = inp()
	process(n)


T = int(input())
for t in range(T):
	n = int(input())
	a = []
	a_1 = []
	a_2 = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			a_1.append(i)
		else:
			a_2.append(i)
	if abs(sum(a_1) - sum(a_2)) % 2 != 0:
		print('NO')
	else:
		a_2[-1] += abs(sum(a_1) - sum(a_2))
		a = a_1 + a_2
		print('YES')
		for i in a:
			print(i, end=' ')


for test in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	x = n // 2
	f = []
	s = []
	f.append(2)
	s.append(1)
	for i in range(1, x):
		f.append(4 * (i + 1))
		if i % 2 != 0:
			s.append(f[-1] + 1)
		else:
			s.append(f[-1] - 1)
	print('YES')
	print(*f + s)


T = int(input())
for t in range(0, T):
	N = int(input())
	if N / 4 % 1 != 0:
		print(*'NO', sep='')
		continue
	print(*'YES', sep='')
	amt = int(N / 2)
	evens = list((2 * n for n in range(1, amt + 1)))
	odds = list((2 * n - 1 for n in range(1, amt)))
	odds.append(3 * amt - 1)
	nums = evens + odds
	print(*nums)


for t in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		l = [0] * n
		last = 2
		for i in range(n // 2):
			l[i] = last
			last += 4
		last = 3
		for i in range(n // 2, n):
			l[i] = last
			j = i - n // 2
			if j % 2 == 0:
				last += 2
			else:
				last += 6
		print('YES')
		print(' '.join(map(str, l)))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	t = 2
	k = 1
	if n % 4 != 0:
		print('NO')
	else:
		s = 0
		print('YES')
		for i in range(int(n / 2)):
			l.append(t)
			s += t
			t += 2
		for i in range(int(n / 2) - 1):
			l.append(k)
			s -= k
			k += 2
		l.append(s)
		print(' '.join((str(x) for x in l)))


N = int(input())
for i in range(N):
	n = int(input())
	a = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			a.append(str(2 * i))
		for i in range(1, n // 2):
			a.append(str(2 * i - 1))
		a.append(str(2 * (n // 2) - 1 + n // 2))
		print(' '.join(a))


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	b = []
	m = int(n / 2)
	if m % 2 == 1:
		print('NO')
	else:
		print('YES')
		k = 1
		num = n
		while k <= num:
			if k % 3 == 0:
				num += 1
				k += 1
				continue
			if k % 2 == 1:
				b.append(k)
				k += 1
			else:
				a.append(k)
				k += 1
		st = ''
		for j in a:
			st += str(j)
			st += ' '
		for j in b:
			st += str(j)
			st += ' '
		print(st)


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		res = [None] * n
		res[0] = 2
		res[k] = 1
		for i in range(1, k):
			res[i] = res[i - 1] + 2
		for i in range(k + 1, n - 1):
			res[i] = res[i - 1] + 2
		res[n - 1] = int((res[k - 1] + 2) * k / 2 - (res[n - 2] + 1) * (k - 1) / 2)
		print(*res)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		mi = 2
		max = 10 ** 8
		l1 = []
		l2 = []
		fl = 0
		for i in range(n // 2):
			if fl == 0:
				l1.append(mi)
				l2.append(mi + 1)
				mi = mi + 10
				fl = 1
			else:
				l1.append(mi)
				l2.append(mi - 1)
				fl = 0
				mi = mi + 10
		for i in range(n // 2):
			print(str(l1[i]), end=' ')
		for i in range(n // 2):
			print(str(l2[i]), end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	n = n // 2
	if n % 2 == 1:
		print('No')
	else:
		print('Yes')
		arr = []
		for i in range(n):
			arr.append((i + 1) * 2)
		j = 1
		for i in range(n - 1):
			arr.append(j)
			j = j + 2
		arr.append(arr[n - 1] + n - 1)
		print(str(' '.join(map(str, arr))))


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		ans = []
		for i in range(2, x * 2 + 1, 2):
			ans.append(i)
		for i in range(1, x * 2, 2):
			ans.append(i)
		ans[len(ans) - 1] += x
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	a = n // 2
	l = []
	if a % 2 != 0:
		print('NO')
	else:
		print('YES')
		r = 2
		for i in range(n // 2):
			l.append(r)
			val = r
			r += 2
			k = i
		r1 = 1
		for i in range(n // 2 - 1):
			l.append(r1)
			r1 += 2
		l.append(k + val)
		print(*l)


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

def I():
	return list(map(int, inp().split()))
from math import log2
for _ in range(I()[0]):
	n = I()[0]
	a = [0] * n
	for i in range(2, n + 2, 2):
		a[i // 2 - 1] = i
	for i in range(1, n, 2):
		a[n // 2 + i // 2] = i
	a[-1] += n // 2
	if a[-1] % 2 == 0:
		print('NO')
	else:
		print('YES')
		print(*a)


def balance(n):
	arr = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			arr.append(i)
		first = arr[:len(arr) // 2]
		last = arr[len(arr) // 2:]
		for i in first:
			arr.append(i - 1)
		for i in last:
			arr.append(i + 1)
		for i in range(len(arr)):
			if i is not len(arr) - 1:
				print(arr[i], end=' ')
			else:
				print(arr[i])
t = int(input())
for _ in range(t):
	n = int(input())
	balance(n)


import sys
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	x = inp()
	if x % 4 != 0:
		print('NO')
	else:
		print('YES')
		stra = ''
		for j in range(x // 2):
			stra += str((j + 1) * 2) + ' '
		for j in range(x // 2 - 1):
			stra += str(j * 2 + 1) + ' '
		stra += str(x + x // 2 - 1)
		print(stra)


import sys
input = sys.stdin.readline
t = int(input())
for i1 in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	else:
		num = n + 1
		pair = n // 2
		if pair % 2 == 0:
			print('YES')
			one = []
			two = []
			for i in range(1, num + 1):
				if i != (num + 1) // 2:
					if i % 2 == 0:
						one.append(i)
					else:
						two.append(i)
			s = ''
			for i in range(len(one)):
				s += str(one[i]) + ' '
			for i in range(len(two)):
				s += str(two[i]) + ' '
			print(s)
		else:
			print('NO')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		w = n // 2
		if w % 2 == 1:
			print('NO')
			continue
		print('YES')
		l1 = []
		l2 = []
		for i in range(w - 1):
			i2 = 2 * i
			l1.append(str(i2 + 1))
			l2.append(str(i2 + 2))
		l2.append(str(2 * w))
		l1.append(str(3 * w - 1))
		print(' '.join(l2), end=' ')
		print(' '.join(l1))
main()


from itertools import accumulate
tests = int(input())
for t in range(tests):
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	p = [(a[i], a[n - i - 1]) for i in range(n // 2)]
	r = [(min(a, b) + 1, +1) for (a, b) in p] + [(a + b, +1) for (a, b) in p] + [(a + b + 1, -1) for (a, b) in p] + [(max(a, b) + k + 1, -1) for (a, b) in p]
	print(n - max(list(accumulate([x for (_, x) in sorted(r)]))))


a = int(input())
for k in range(a):
	n = int(input().strip())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		s1 = 0
		s2 = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			s1 += i
		for j in range(1, n - 2, 2):
			print(j, end=' ')
			s2 += j
		print(s1 - s2)


for f in range(int(input())):
	n = int(input())
	nh = n // 2
	if nh % 2 == 0:
		print('YES')
		s = [0] * n
		for i in range(nh):
			s[i] = 2 * i + 2
			s[i + nh] = 2 * i + 1
		s[-1] += nh
		print(*s)
	else:
		print('NO')


def ans(n):
	if n % 4 != 0:
		return 'NO'
	a = n // 4
	lis = []
	q = 2
	for i in range(n // 2):
		lis.append(q)
		q += 2
	q = 1
	for j in range(a):
		lis.append(q)
		q += 2
	q += 2
	for j in range(a):
		lis.append(q)
		q += 2
	return lis
w = int(input())
for i in range(w):
	e = int(input())
	z = ans(e)
	if z == 'NO':
		print(z)
	else:
		print('YES')
		for i in z:
			print(i, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	e = []
	o = []
	q = 0
	s = []
	for i in range(1, 2 * n):
		if i % 2 == 0:
			e.append(i)
		else:
			o.append(i)
		if len(e) == n // 2 + 1:
			break
	e.pop()
	q = len(o)
	if q % 2 == 0:
		o.pop(int(q / 2))
	else:
		o.pop((q + 1) // 2 - 1)
	s = e + o
	if s == []:
		print('NO')
	elif sum(e) != sum(o):
		print('NO')
	else:
		print('YES')
		for i in s:
			print(i, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		lista = []
		k = 2
		for j in range(int(n / 2)):
			count += k
			lista.append(k)
			k = k + 2
		l = 1
		for j in range(int(n / 2), n):
			if j != n - 1:
				count -= l
				lista.append(l)
				l = l + 2
			else:
				lista.append(count)
		for r in lista:
			print(r, end=' ')
		print()


from collections import defaultdict

def solve(n, k, arr):
	ans = n
	memo = defaultdict(int)
	prefix = [0] * (2 * k + 2)
	for i in range(n // 2):
		(x, y) = (arr[i], arr[n - i - 1])
		prefix[min(x, y) + 1] += 1
		prefix[max(x, y) + k + 1] -= 1
		memo[x + y] += 1
	for i in range(1, 2 * k + 2):
		prefix[i] += prefix[i - 1]
	for i in range(2, 2 * k + 1):
		ans = min(ans, prefix[i] - memo[i] + (n // 2 - prefix[i]) * 2)
	print(ans)
for _ in range(int(input())):
	(n, k) = input().strip().split()
	arr = list(map(int, input().strip().split()))
	solve(int(n), int(k), arr)


t = int(input())
n = 0
for i in range(t):
	n = int(input())
	even = []
	odd = []
	a = []
	for y in range(2, n + 1, 2):
		even.append(y)
		a.append(str(y))
	for y in range(1, n + 1, 2):
		odd.append(y)
		a.append(str(y))
	diff = sum(even) - sum(odd)
	if diff % 2 == 0:
		odd[-1] += diff
		a[-1] = str(odd[-1])
		print('YES')
		print(' '.join(a))
	else:
		print('NO')


from sys import stdin, stdout
from collections import Counter

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

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

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

def op(ans):
	return stdout.write(str(ans) + '\n')
for i in range(ip()):
	n = ip()
	if n % 4 != 0:
		print('NO')
	else:
		even = [i for i in range(2, n + 1, 2)]
		odd = [i for i in range(1, n, 2)]
		odd[-1] += n // 2
		print('YES')
		print(*even + odd)


t = int(input())
l = []
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1):
			if i % 2 == 0:
				l.append(i)
		a = len(l)
		b = l[-1]
		for j in range(len(l) - 1):
			l.append(l[j] - 1)
		l.append(b + (a - 1))
		for i in l:
			print(i, end=' ')
		l.clear()


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 != 0 or n == 1:
		print('NO')
	else:
		l = []
		print('YES')
		p = n // 2
		while n:
			l.append(n)
			n = n - 2
		q = sum(l)
		l.sort()
		for i in range(1, 2 * len(l) - 1, 2):
			l.append(i)
		s = sum(l[p:])
		l.append(q - s)
		for i in l:
			print(i, end=' ')
		print()
	t -= 1


from itertools import accumulate

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

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

def sgn(x):
	if x > 0:
		return '+'
	else:
		return '-'

def solve(n, k, a):
	h = [0] * (2 * k + 5)
	for i in range(n // 2):
		j = n - i - 1
		h[0] += 2
		h[min(a[i], a[j]) + 1] -= 1
		h[a[i] + a[j]] -= 1
		h[a[i] + a[j] + 1] += 1
		h[max(a[i], a[j]) + k + 1] += 1
	pref = list(accumulate(h))
	return min(pref)

def main():
	T = int(input())
	for tt in range(T):
		(n, k) = invr()
		a = list(invr())
		print(solve(n, k, a))
main()


nb_cases = int(input())
while nb_cases > 0:
	nb_cases -= 1
	n = int(input())
	if n % 4 == 2:
		print('NO')
		continue
	print('YES')
	for x in range(1, int(n / 2) + 1):
		print(2 * x, end=' ')
	for x in range(1, int(n / 2)):
		print(2 * x - 1, end=' ')
	print(int(n / 2) - 1 + n, end=' ')
	print('')


from collections import Counter, defaultdict
from heapq import heappush, heappop, heapify
import math
from functools import reduce

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ans = []
		value = 2
		for i in range(n // 2):
			ans.append(value)
			value += 2
		rem = 0
		for i in range(0, n // 2):
			if i == n // 2 - 1:
				ans.append(ans[i] + rem)
				continue
			ans.append(ans[i] - 1)
			rem += 1
		print('YES')
		print(*ans)


t = int(input())
for it in range(t):
	n = int(input())
	hal = n // 2
	if n > 2:
		list1 = [2 * x for x in range(1, hal + 1)]
		list2 = [2 * y - 1 for y in range(1, hal)]
		last_element = sum(list1) - sum(list2)
		list2 = list2 + [last_element]
		list_fin = list1 + list2
		if sum(list1) == sum(list2) and last_element % 2 != 0:
			print('YES')
			print(*list_fin)
		else:
			print('NO')
	else:
		print('NO')


import collections
t = int(input())
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	nums = list(map(int, input().split()))
	temp = n // 2
	add = collections.defaultdict(int)
	for j in range(temp):
		add[nums[j] + nums[n - 1 - j]] += 1
	prefix = [0] * (2 * k + 2)
	for j in range(temp):
		l1 = nums[j]
		l2 = nums[n - j - 1]
		r = max(l1, l2) + k + 1
		prefix[min(l1, l2) + 1] += 1
		prefix[r] -= 1
	for j in range(1, 2 * k + 2):
		prefix[j] = prefix[j] + prefix[j - 1]
	ans = float('inf')
	for j in range(2 * k + 2):
		cnt0 = add[j]
		cnt1 = prefix[j] - cnt0
		cnt2 = temp - cnt0 - cnt1
		ans = min(ans, cnt1 + cnt2 * 2)
	print(ans)


test_cases = int(input())
data = []
while test_cases > 0:
	data.append(int(input()))
	test_cases -= 1
for i in range(0, len(data)):
	if data[i] % 4 != 0:
		print('NO')
	else:
		print('YES')
		toPrint = []
		sum = 0
		for j in range(2, data[i] + 1, 2):
			toPrint.append(str(j))
			sum += j
		for k in range(1, data[i] - 2, 2):
			toPrint.append(str(k))
			sum -= k
		toPrint.append(str(sum))
		print(' '.join(toPrint))


cases = int(input(''))
caseslist = []
arraylist = []
evencounter = 0
oddcounter = 0
for case in range(cases):
	length = int(input(''))
	caseslist.append(length)
for case in range(cases):
	even = 0
	odd = 1
	for c in range(int(caseslist[case] / 2)):
		even += 2
		arraylist.append(even)
		evencounter += even
	for y in range(int(caseslist[case] / 2)):
		if y == int(caseslist[case] / 2) - 1 and (even + int(caseslist[case] / 2) - 1) % 2 != 0:
			arraylist.append(even + int(caseslist[case] / 2) - 1)
			oddcounter += even + int(caseslist[case] / 2) - 1
		else:
			arraylist.append(odd)
			oddcounter += odd
			odd += 2
	if evencounter == oddcounter:
		print('YES')
		print(*arraylist, sep=' ')
	else:
		print('NO')
	evencounter = oddcounter = 0
	arraylist = []


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	su = [0] * (2 * k + 2)
	for i in range(n // 2):
		(a, b) = (min(ar[i], ar[n - i - 1]), max(ar[i], ar[n - i - 1]))
		su[0] += 2
		su[a + 1] -= 1
		su[a + b] -= 1
		su[a + b + 1] += 1
		su[b + k + 1] += 1
	ans = []
	prev = 0
	for j in range(2 * k + 1):
		prev += su[j]
		ans.append(prev)
	print(min(ans))


import sys
from collections import Counter

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a

def calc(x):
	c = 0
	n = len(arr)
	for i in range(n // 2):
		if sumarr[i] != x:
			m = max(arr[i], arr[n - i - 1])
			if sumarr[i] < x:
				m = min(arr[i], arr[n - i - 1])
				m += x - sumarr[i]
				if m > k:
					c += 2
				else:
					c += 1
			else:
				m = max(arr[i], arr[n - i - 1])
				m -= sumarr[i] - x
				if m < 0:
					c += 2
				else:
					c += 1
	return c
for __ in range(int(input())):
	(n, k) = I()
	arr = I()
	sumarr = [0] * (n // 2)
	for i in range(n // 2):
		sumarr[i] = arr[i] + arr[n - i - 1]
	c = Counter(sumarr)
	prefarr = [0] * (2 * k + 2)
	for i in range(n // 2):
		(a, b) = (max(arr[i], arr[n - i - 1]), min(arr[i], arr[n - i - 1]))
		r = a + k
		l = b + 1
		prefarr[l] += 1
		prefarr[r + 1] -= 1
	minans = n
	for i in range(1, 2 * k + 1):
		prefarr[i] += prefarr[i - 1]
		minans = min(minans, prefarr[i] - c.get(i, 0) + 2 * (n // 2 - prefarr[i]))
	print(minans)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	a = list(range(2, n + 1, 2))
	for i in range(n // 4):
		a.append(a[i] - 1)
		a.append(a[n // 2 - i - 1] + 1)
	print(*a)


def oddIntegers(n, k):
	ll = []
	sum = 0
	i = 1
	j = 1
	while j < k:
		sum += i
		ll.append(i)
		i += 2
		j += 1
	finalOdd = n - sum
	ll.append(finalOdd)
	return ll
t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		li = []
		te = 2
		for i in range(x):
			li.append(te)
			te = te + 2
		su = sum(li)
		le = oddIntegers(su, x)
		print(*li, end=' ')
		print(*le)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
		continue
	elif (n - 2) % 4 == 0:
		print('NO')
		continue
	l1 = []
	l2 = []
	for x in range(1, int(n / 2) + 1):
		l1.append(2 * x)
	for x in range(1, int(n / 2)):
		l2.append(2 * x - 1)
	l2.append(len(l2) + l1[int(n / 2) - 1])
	l = l1 + l2
	print('YES')
	for w in l:
		print(w, end=' ')


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


t = int(input())
i = 0
while i < t:
	n = int(input())
	n /= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		(k, l, s) = (2, 0, 0)
		while l < n:
			print(k, end=' ')
			s += k
			k += 2
			l += 1
		(k, l, ss) = (1, 0, 0)
		while l < n - 1:
			print(k, end=' ')
			ss += k
			k += 2
			l += 1
		print(s - ss)
	i += 1


import sys
input = sys.stdin.readline
from collections import deque
t = int(input())

def inc(n, arr, l, r):
	if l <= r and l >= 0:
		arr[l] += n
		if r + 1 <= len(arr) - 1:
			arr[r + 1] -= n
for i1 in range(t):
	(n, k) = list(map(int, input().split(' ')))
	l1 = list(map(int, input().split(' ')))
	arr = [0] * (2 * k + 1)
	for i in range(n // 2):
		z1 = l1[i]
		z2 = l1[n - i - 1]
		s = z1 + z2
		min1 = min(z1, z2)
		max1 = max(z1, z2)
		if s != 2 * k:
			(l, r) = (s + k - min1 + 1, 2 * k)
			inc(2, arr, l, r)
			(l, r) = (s + 1, s + k - min1)
			inc(1, arr, l, r)
		(l, r) = (s - (max1 - 1), s - 1)
		inc(1, arr, l, r)
		(l, r) = (0, s - (max1 - 1) - 1)
		inc(2, arr, l, r)
	for i in range(1, len(arr)):
		arr[i] += arr[i - 1]
	print(min(arr))


for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print('NO')
	elif n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		(lo, last) = (0, 0)
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
			lo += 2 * i
			last = 2 * i
		lo -= last
		for i in range(1, n // 2):
			print(2 * i - 1, end=' ')
			lo -= 2 * i - 1
		print(last + lo)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		mid = n // 2
		ans = []
		sm = 0
		v = 2
		for i in range(mid):
			ans.append(v)
			sm += v
			v += 2
		sm1 = 0
		v1 = 1
		for i in range(mid - 1):
			ans.append(v1)
			sm1 += v1
			v1 += 2
		ans.append(sm - sm1)
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		mid = n // 2
		arr = [int(i) * 2 for i in range(1, mid + 1)]
		x = sum(arr)
		y = 0
		for i in range(len(arr) - 1):
			arr.append(arr[i] - 1)
			y = y + arr[i] - 1
		arr.append(x - y)
		for i in arr:
			print(i, end=' ')
		print(' ')


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N, K, A):
	M = 2 * K + 1
	x = [0 for _ in range(M)]
	add = [0 for _ in range(M)]
	minus = [0 for _ in range(M)]
	wc = collections.defaultdict(int)
	for i in range(N // 2):
		(a, b) = (A[i], A[N - i - 1])
		wc[a + b] += 1
		(s, t) = (min(a, b) + 1, max(a, b) + K + 1)
		if s < M:
			add[s] += 1
		if t < M:
			minus[t] += 1
	s = 0
	for i in range(M):
		s += add[i]
		s -= minus[i]
		x[i] = s
	ans = N
	for target in range(2, M):
		one = x[target] - wc[target]
		two = N // 2 - wc[target] - one
		ans = min(ans, one + 2 * two)
	return ans
T = int(input())
ans = []
for ti in range(T):
	(N, K) = map(int, input().split())
	A = [int(x) for x in input().split()]
	ans.append(solve(N, K, A))
print('\n'.join(map(str, ans)))


t = int(input())
for z in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		array = []
		for i in range(n // 4):
			array.append(i * 6 + 2)
			array.append(i * 6 + 4)
		for i in range(n // 4):
			array.append(i * 6 + 1)
			array.append(i * 6 + 5)
		for i in range(len(array)):
			array[i] = str(array[i])
		print('YES')
		print(' '.join(array))


def func(n):
	for i in range(n):
		y = int(input())
		even = [x for x in range(1, y + 1) if x % 2 == 0]
		odd = [x for x in range(1, y + 1) if x % 2 != 0]
		odd[-1] += y // 2
		if y % 4 != 0:
			print('NO')
		else:
			print('YES')
			print(*even + odd)
n = int(input())
func(n)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, functools

def solve(line):
	n = int(line)
	if n // 2 % 2 == 1:
		print('NO')
		return
	a = [2 * (i + 1) for i in range(n // 2)]
	a.extend((2 * i + 1 for i in range(n // 2 - 1)))
	a.append(n + n // 2 - 1)
	print('YES')
	print(' '.join(map(str, a)))
	return
T = int(sys.stdin.readline())
t = 0
while True:
	line = sys.stdin.readline().rstrip()
	if not line:
		break
	solve(line)
	t += 1


import sys, math
input = sys.stdin.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().strip()

def listStr():
	return list(input().strip())
import collections as col
import math, itertools

def solve():
	(N, K) = getInts()
	A = getInts()
	pairs = col.defaultdict(int)
	min_el = col.defaultdict(int)
	max_el = col.defaultdict(int)
	for j in range(N // 2):
		pairs[A[j] + A[N - 1 - j]] += 1
		min_el[min(A[j], A[N - 1 - j])] += 1
		max_el[max(A[j], A[N - 1 - j])] += 1
	min_greater = [0]
	max_less = [0]
	for j in range(K, 0, -1):
		min_greater.append(min_greater[-1] + min_el[j])
	min_greater.reverse()
	min_greater = [min_greater.pop()] + min_greater
	for j in range(1, K + 1):
		max_less.append(max_less[-1] + max_el[j])
	best = 10 ** 9
	for pair in pairs:
		baseline = N // 2 - pairs[pair]
		if pair - K > 1:
			baseline += max_less[pair - K - 1]
		if pair - 1 < K:
			baseline += min_greater[pair]
		best = min(baseline, best)
	return min(best, N // 2)
for _ in range(getInt()):
	print(solve())


t = int(int(input()))
for x in range(t):
	n = int(input())
	if n <= 2:
		print('NO')
	elif n // 2 % 2 != 0:
		print('NO')
	else:
		List = [0 for y in range(n)]
		e = 2
		i = 0
		while i < n // 2:
			List[i] = e
			e += 2
			i += 1
		e = 1
		while i < n:
			List[i] = e
			e += 2
			i += 1
		List[n - 1] += n // 2
		print('YES')
		print(*List)


t = int(input())
nlist = [int(input()) for x in range(t)]
for x in range(t):
	if nlist[x] % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		sum2 = 0
		for y in range(1, nlist[x] + 1):
			if y <= nlist[x] / 2:
				print(y * 2, end=' ')
				sum += y * 2
			elif y <= nlist[x] - 1:
				print(int((y - nlist[x] / 2 - 1) * 2 + 1), end=' ')
				sum2 += (y - nlist[x] / 2 - 1) * 2 + 1
			elif y == nlist[x]:
				print(int(sum - sum2))


import sys
import math
import heapq
from collections import defaultdict, deque
input = sys.stdin.readline

def r():
	return int(input())

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

def rl():
	return list(map(int, input().split()))
for _ in range(r()):
	n = r()
	if n // 2 & 1:
		print('NO')
		continue
	a = []
	k = 2
	for i in range(n // 2):
		a.append(k)
		k += 4
	for j in range(n // 2):
		if j & 1:
			a.append(a[j] - 1)
		else:
			a.append(a[j] + 1)
	print('YES')
	print(*a)


for testcase in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	print('YES')
	print(*(i for i in range(2, n + 1, 2)), end=' ')
	print(*(i for i in range(1, n - 1, 2)), end=' ')
	print(n - 1 + n // 2)


t = int(input())
while t:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		i = 2
		temp = n // 2
		temp1 = temp
		while temp:
			l.append(i)
			i += 2
			temp -= 1
		i = 1
		while temp1:
			l.append(i)
			i += 2
			temp1 -= 1
		l[-1] = l[-1] + n // 2
		for i in l:
			print(i, end=' ')
		print()
	t = t - 1


for i in range(int(input())):
	n = int(input())
	out = []
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(n / 2 + 1)):
			out.append(2 * i)
		for i in range(int(n / 2)):
			if i < n / 4:
				out.append(out[i] - 1)
			else:
				out.append(out[i] + 1)
		for i in range(len(out)):
			print(out[i], end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	l1 = []
	c2 = 2
	c1 = 1
	sum1 = 0
	if n % 4 != 0:
		print('No')
	else:
		for j in range(int(n / 2)):
			l1.append(c2)
			sum1 += c2
			c2 += 2
		for j in range(int(n / 2) - 1):
			l1.append(c1)
			sum1 -= c1
			c1 += 2
		l1.append(sum1)
		print('Yes')
		for j in range(len(l1)):
			print(l1[j], end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	even = []
	odd = []
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			even.append(2 * (i + 1))
		for i in range(len(even) - 1):
			odd.append(even[i] - 1)
		odd.append(even[-1] + len(even) - 1)
		for i in even:
			print(i, end=' ')
		for i in odd:
			print(i, end=' ')
		print()


lst = [int(input()) for i in range(int(input()))]
for n in lst:
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	a = []
	b = []
	for i in range(2, n + 1, 2):
		a.append(str(i))
		b.append(str(i - 1))
	b[-1] = str(int(b[-1]) + n // 2)
	print(' '.join(a + b))


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	l = []
	p = 0
	for i in range(n // 2):
		p += 2
		l.append(p)
	s = sum(l)
	p = -1
	for i in range(n // 2 - 1):
		p += 2
		l.append(p)
	l.append(s - sum(l[n // 2:]))
	print(' '.join(map(str, l)))


test = int(input())
for _ in range(test):
	num = int(input())
	even = []
	odd = []
	e = 0
	o = 1
	n = num // 2
	if n % 2:
		print('NO')
	else:
		print('YES')
		for i in range(2, num + 2, 2):
			e += i
			even.append(i)
		j = 0
		while e:
			if j != n - 1:
				odd.append(o)
				e -= o
				o += 2
				j += 1
			else:
				odd.append(e)
				e -= e
		print(' '.join(map(str, even + odd)))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	s = 0
	a = []
	for i in range(1, n // 2 + 1):
		a += [2 * i]
		s += 2 * i
	for i in range(n // 2 - 1):
		a += [2 * i + 1]
		s -= 2 * i + 1
	a += [s]
	print('YES')
	print(' '.join((str(k) for k in a)))


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()
t_c = ii()
for _ in range(t_c):
	(n, k) = mi()
	lazy = [0] * (2 * k + 10)
	a = li()
	d = [0] * (2 * k + 10)
	(i, j) = (0, n - 1)
	lim = []
	while i < j:
		d[a[i] + a[j]] += 1
		lazy[min(a[i], a[j]) + 1] += 1
		lazy[max(a[i], a[j]) + k + 1] -= 1
		i += 1
		j -= 1
	ans = n
	for i in range(1, len(lazy)):
		lazy[i] += lazy[i - 1]
		ans = min(ans, n - lazy[i] * 2 + lazy[i] - d[i])
	print(ans)


import math

def YES_or_NO(n):
	sum_2 = 0
	sum_1 = 0
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		x = int(n / 2)
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(n - 1 + x)
t = int(input())
for i in range(t):
	YES_or_NO(int(input()))


from bisect import bisect_left, bisect_right

def solve(arr, k):
	n = len(arr)
	max_val = []
	min_val = []
	cnt = {}
	for i in range(n // 2):
		(lhs, rhs) = (arr[i], arr[n - i - 1])
		if lhs > rhs:
			(lhs, rhs) = (rhs, lhs)
		arr[i] = lhs
		arr[n - i - 1] = rhs
		key = lhs + rhs
		cnt.setdefault(key, 0)
		cnt[key] += 1
		max_val.append(k + rhs)
		min_val.append(lhs + 1)
	min_val.sort()
	max_val.sort()
	ans = n
	for x in range(2, 2 * k + 1):
		left_idx = bisect_right(min_val, x)
		right_idx = bisect_left(max_val, x)
		below = n // 2 - left_idx
		above = right_idx
		affect = n // 2 - cnt.get(x, 0)
		candidate = affect + below + above
		ans = min(ans, candidate)
	return ans
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(*arr,) = map(int, input().split())
	print(solve(arr, k))


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

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

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

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

def findmin(x, y):
	if x < y:
		return x
	return y

def findmax(x, y):
	if x > y:
		return x
	return y
t = inp()
for i in range(0, t):
	(n, k) = invr()
	a = list(invr())
	(min, max) = (0, 0)
	f = [0] * (2 * k + 2)
	cnt = [0] * (2 * k + 1)
	for j in range(0, int(n / 2)):
		cnt[a[j] + a[n - j - 1]] = cnt[a[j] + a[n - j - 1]] + 1
		min = findmin(a[j], a[n - j - 1]) + 1
		max = findmax(a[j], a[n - j - 1]) + k
		f[min] = f[min] + 1
		f[max + 1] = f[max + 1] - 1
	for j in range(1, 2 * k + 1):
		f[j] = f[j] + f[j - 1]
	result = 999999
	for l in range(2, 2 * k + 1):
		q = f[l] - cnt[l] + (n / 2 - f[l]) * 2
		if result > q:
			result = q
	print(int(result))


n = int(input())
list3 = []
for x in range(n):
	list1 = []
	list2 = []
	m = int(input())
	j = int(m / 2)
	if m % 4 == 0:
		for y in range(1, j + 1):
			list1.append(2 * y)
		for z in range(1, j):
			list2.append(2 * z - 1)
		list2.append(j * 3 - 1)
		print('YES')
		list1.extend(list2)
		u = ' '.join(map(str, list1))
		print(u)
	else:
		print('No')


for _ in range(int(input())):
	y = int(input())
	if y % 4 == 2:
		print('NO')
	else:
		a = []
		print('YES')
		s = 0
		for i in range(y // 2):
			x = 2 * (i + 1)
			a.append(x)
			s += x
		s1 = 0
		for i in range(y // 2 - 1):
			x = 2 * i + 1
			a.append(x)
			s1 += x
		a.append(s - s1)
		print(*a)


def function(a):
	arr = []
	if a // 2 % 2 == 0:
		print('YES')
		arr.extend(range(2, a + 1, 2))
		arr.extend(range(1, a - 1, 2))
		arr.append(a // 2 * (a // 2 + 1) - (a // 2 - 1) ** 2)
		print(' '.join(map(str, arr)))
	else:
		print('NO')
t = int(input())
for _ in range(t):
	a = int(input())
	function(a)


def solve(n):
	if n == 0 or n % 4 != 0:
		return []
	left = [i * 2 + 2 for i in range(n // 2)]
	right_target = sum(left)
	right = [i * 2 + 1 for i in range(n // 2)]
	right[-1] += right_target - sum(right)
	return [*left, *right]
t = int(input())
for i in range(t):
	n = int(input())
	sol = solve(n)
	if len(sol) == 0:
		print('NO')
	else:
		print('YES')
		print(' '.join(list(map(str, sol))))


ts = int(input(''))
while ts > 0:
	n = int(input(''))
	t = n // 2
	s = ''
	if t % 2 != 0:
		print('NO')
		ts -= 1
		continue
	k = 2
	s1 = 0
	for i in range(t):
		s += str(k) + ' '
		s1 += k
		k += 2
	k2 = 1
	s2 = 0
	for j in range(t - 1):
		s += str(k2) + ' '
		s2 += k2
		k2 += 2
	ls = s1 - s2
	s += str(ls)
	print('YES')
	print(s)
	ts -= 1


w = int(input())
while w > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	elif n < 4:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		s = n / 2 * (2 * 2 + (n / 2 - 1) * 2) // 2
		q = (n / 2 - 1) * (2 * 1 + (n / 2 - 2) * 2) // 2
		t = 2 + (n / 2 - 1) * 2 + (n // 2 - 1)
		if s == q + t:
			for i in range(2, n + 1, 2):
				print(i, end=' ')
			for i in range(1, n - 1, 2):
				print(i, end=' ')
			print(int(t))
	w = w - 1


t = int(input())
for i in range(t):
	n = int(input())
	n1 = n / 2
	if n1 % 2 != 0:
		print('NO')
	else:
		b1 = []
		b2 = []
		print('YES')
		for i in range(2, n + 1, 2):
			b1.append(i)
		for i in range(len(b1) - 1):
			b2.append(b1[i] - 1)
		b2.append(b1[-1] + n // 2 - 1)
		b1.extend(b2)
		print(*b1)


ins = int(input())
entries = []
for i in range(0, ins):
	entries.append(int(input()))
for i in range(0, ins):
	if entries[i] / 2 % 2 != 0:
		print('NO')
	else:
		sum_od = 0
		sum_ev = 0
		sum_all_ev = 0
		sum_all_od = 0
		print('YES')
		for j in range(0, entries[i]):
			if j < entries[i] / 2:
				sum_ev = (j + 1) * 2
				sum_all_ev = sum_all_ev + sum_ev
				print(sum_ev, end=' ')
			elif j < entries[i] - 1 and j >= entries[i] / 2:
				sum_od = (j - entries[i] / 2) * 2 + 1
				sum_all_od = sum_all_od + sum_od
				print(int(sum_od), end=' ')
		print(int(sum_all_ev - sum_all_od))


t = int(input())
for i in range(t):
	x = int(input())
	lst = []
	lst2 = []
	z = 1
	y = 2
	if x // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(x // 2):
			lst2.append(y)
			lst.append(z)
			y += 2
			z += 2
		print(' '.join(map(str, lst2)), ' '.join(map(str, lst[0:-1])), sum(lst2) - sum(lst[0:-1]))


def sol(li, n):
	for i in range(n // 2):
		li.append(2 * (i + 1))
	for j in range(n // 2 - 1):
		li.append(2 * j + 1)
	comp = li[n // 2 - 1] + n // 2 - 1
	if comp % 2:
		li.append(li[n // 2 - 1] + n // 2 - 1)
		return 'YES'
	return 'NO'
t = int(input())
while t > 0:
	n = int(input())
	li = []
	ans = sol(li, n)
	if ans == 'YES':
		print('YES')
		for ele in li:
			print(ele, end=' ')
		print()
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		x = []
		i = 2
		for j in range(n // 2):
			x.append(i)
			i += 2
		sm = sum(x)
		i = 1
		for j in range(n // 2):
			x.append(i)
			i += 2
		sm2 = sum(x)
		diff = 2 * sm - sm2
		x[-1] += diff
		print(*x)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	l = []
	m = []
	for j in range(2, n + 2, 2):
		l.append(j)
	for j in range(1, n - 1, 2):
		m.append(j)
	m.append(sum(l) - sum(m))
	l += m
	print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		arr = [2 * i + 2 for i in range(n // 2)]
		arr.extend([2 * i + 1 for i in range(n // 2)])
		arr[-1] += n // 2
		print(' '.join(map(str, arr)))


lst = []
t = int(input())
for i in range(t):
	n = int(input())
	lst.append(n)
for j in lst:
	if j % 4 == 0:
		lst2 = []
		lst1 = [k for k in range(2, j + 1, 2)]
		for m in range(len(lst1) - 1):
			lst2.append(lst1[m] - 1)
		lst2.append(lst1[-1] + len(lst1) - 1)
		print('YES')
		for f in lst1 + lst2:
			print(f, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		ans = list(range(2, n + 2))
		ans[-2] += n // 2
		ans.sort(key=lambda num: num % 2 == 1)
		print('YES')
		print(*ans)


t = int(input())
for i in range(t):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		c = []
		for j in range(2, a + 1, 2):
			c += [j]
		d = []
		for j in range(1, a - 1, 2):
			d += [j]
		d += [a + (a - 1) // 2]
		c = c + d
		print(*c)


from collections import defaultdict

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	res = 10 * n
	d = defaultdict(int)
	cost = [0] * (2 * k + 10)
	for i in range(n // 2):
		(x, y) = (a[i], a[-i - 1])
		cost[x + y] -= 1
		cost[x + y + 1] += 1
		cost[min(x, y) + 1] -= 1
		cost[max(x, y) + k + 1] += 1
		cost[1] += 2
	for i in range(1, 2 * k + 1):
		cost[i] += cost[i - 1]
		res = min(res, cost[i])
	print(res)
	return

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


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		s1 = 0
		for i in range(0, n, 2):
			l.append(i + 2)
			s1 += i + 2
		l2 = []
		s2 = 0
		for i in range(len(l) - 1):
			l2.append(l[i] - 1)
			s2 += l[i] - 1
		ll = l + l2
		ll.append(s1 - s2)
		for i in ll:
			print(i, end=' ')
		print()


TEST = int(input())
answers = []
for _ in range(TEST):
	n = int(input())
	arr = []
	if (n >> 1) % 2 == 1:
		answers.append(['NO'])
	else:
		b = 1
		for i in range(n // 4):
			arr.append(b)
			arr.append(b + 1)
			arr.append(b + 3)
			arr.append(b + 4)
			b += 6
		answers.append(['YES'])
		arr.sort(key=lambda x: x % 2 == 1)
		answers.append(arr)
for ans in answers:
	print(*ans)


import sys
t = int(input())

def solve(n):
	for i in range(2, 2 * n // 2 + 1, 2):
		print(i, end=' ')
	for i in range(1, 2 * n // 2 - 1, 2):
		print(i, end=' ')
	print(3 * n // 2 - 1)
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		solve(n)
	else:
		print('NO')


import math
import sys
t = int(input())
for cs in range(t):
	n = int(input())
	lf = ri = 0
	if n % 4:
		print('NO')
		continue
	print('YES')
	for i in range(n // 2):
		print((i + 1) * 2, end=' ')
		lf += (i + 1) * 2
	for i in range(n // 2 - 1):
		print(i * 2 + 1, end=' ')
		ri += i * 2 + 1
	print(lf - ri)


def bs(a):
	low = 0
	high = len(li) - 1
	while low <= high:
		if high - low < 5:
			for i in range(low, high + 1):
				if li[i] >= a:
					return i
			return 0
		mid = (low + high) // 2
		if li[mid] >= a:
			high = mid
		else:
			low = mid + 1

def bs2(a):
	low = 0
	high = len(l) - 1
	while low <= high:
		if high - low < 5:
			for i in range(low, high + 1):
				if l[i] > a:
					return len(l) - i
			return 0
		mid = (low + high) // 2
		if l[mid] > a:
			high = mid
		else:
			low = mid + 1
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = list(map(int, input().split()))
	l = []
	li = []
	sum = []
	dict = {}
	for i in range(n // 2):
		l.append(min(s[i], s[n - 1 - i]))
		li.append(max(s[i], s[n - 1 - i]))
		if dict.get(s[i] + s[n - 1 - i]) is None:
			dict[s[i] + s[n - 1 - i]] = 0
		dict[s[i] + s[n - 1 - i]] += 1
	for x in dict.keys():
		sum.append((x, dict[x]))
	l.sort()
	li.sort()
	ans = n // 2
	for p in sum:
		x = 0
		y = 0
		if p[0] > k:
			x = p[0] - k
			y = k
			z = bs(x)
			ans = min(ans, 2 * z + n // 2 - z - p[1])
		else:
			x = 1
			y = p[0] - 1
			z = bs2(y)
			ans = min(ans, 2 * z + n // 2 - z - p[1])
	print(ans)


import sys
t = int(input())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = [i * 2 for i in range(1, n // 2 + 1)]
		b = [i - 1 for i in a]
		b[-1] = sum(a) - sum(b[:-1])
		print(*a + b)


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):
	l = inlt()
	n = l[0]
	k = l[1]
	lp = 2
	rp = 2 * k
	normal_sum = []
	l = inlt()
	list_val = [0] * (2 * k + 2)
	count = [0] * (2 * k + 2)
	for i in range(n // 2):
		val = l[i] + l[-i - 1]
		rp = k + max(l[i], l[-i - 1])
		lp = 1 + min(l[i], l[-i - 1])
		list_val[val] += 1
		count[lp] -= 1
		count[rp + 1] += 1
	curr = n
	ans = n
	for x in range(2, 2 * k + 2):
		curr += count[x]
		ans = min(ans, curr - list_val[x])
	print(ans)


from sys import stdin

def help():
	(n, k) = map(int, stdin.readline().split(' '))
	arr = list(map(int, stdin.readline().split(' ')))
	readucearr = [0] * (2 * k + 5)
	donearr = [0] * (2 * k + 5)
	for i in range(n // 2):
		a1 = arr[i]
		a2 = arr[n - i - 1]
		(a1, a2) = (min(a1, a2), max(a1, a2))
		readucearr[a1 + 1] += 1
		readucearr[a2 + k + 1] -= 1
		donearr[a1 + a2] += 1
	ans = 10000000
	sumyet = 0
	for i in range(0, 2 * k + 5):
		sumyet += readucearr[i]
		if i >= 2 and i <= 2 * k:
			posians = (n // 2 - sumyet) * 2 + (sumyet - donearr[i])
			ans = min(ans, posians)
	print(ans)
for i in range(int(stdin.readline())):
	help()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	list_num = list(map(int, sys.stdin.readline().split()))
	list_check = [0] * (2 * k + 2)
	for i in range(n // 2):
		(a, b) = sorted([list_num[i], list_num[-1 - i]])
		list_check[a + b] -= 1
		list_check[a + b + 1] += 1
		list_check[a + 1] -= 1
		list_check[k + b + 1] += 1
	res = 100000000
	now = n
	for i in range(1, 2 * k + 1):
		now += list_check[i]
		res = min(res, now)
	print(res)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		first = [int(2 * i) for i in range(1, n // 2 + 1)]
		s = sum(first)
		second = [int(2 * i) - 1 for i in range(1, n // 2)]
		second.append(s - sum(second))
		print(*first, end=' ')
		print(*second)


import itertools
numcases = int(input())

def minmoves(asum, a, k):
	count = {x: 0 for x in range(2 * k + 1)}
	ans = 1000000
	moves = 0
	for sum in asum:
		count[sum] = count[sum] + 1
	rangex = [0 for i in range(2 * k + 2)]
	(lower, upper) = (0, 0)
	for i in range(int(n / 2)):
		lower = min(a[i], a[n - 1 - i]) + 1
		upper = max(a[i], a[n - 1 - i]) + k
		rangex[lower] += 1
		rangex[upper + 1] -= 1
	prefix = list(itertools.accumulate(rangex))
	for i in range(2, 2 * k + 1):
		moves = prefix[i] - count[i] + 2 * (n / 2 - prefix[i])
		if moves < ans:
			ans = moves
	return ans
for z in range(numcases):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	asum = []
	sols = []
	for i in range(int(n / 2)):
		asum.append(a[i] + a[n - 1 - i])
	ans = minmoves(asum, a, k)
	print(int(ans))


test = int(input())
for i in range(test):
	even_list = []
	odd_list = []
	val = int(input())
	if val % 2 == 0:
		div = val // 2
		if div % 2 == 0:
			print('YES')
			for i in range(2, val + 1, 2):
				even_list.append(i)
			for i in range(1, val - 1, 2):
				odd_list.append(i)
			last_dig = sum(even_list) - sum(odd_list)
			print(' '.join(map(str, even_list)), ' '.join(map(str, odd_list)), last_dig)
		else:
			print('NO')


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	n = int(inp().strip())
	a = [-1] * n
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		even = 2
		odd = 1
		for i in range(n):
			if i < n / 2:
				a[i] = even
				even += 2
			else:
				if i == n - 1:
					a[i] = int(odd + n // 2)
				else:
					a[i] = odd
				odd += 2
		print(*a)


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
import sys
input = sys.stdin.readline
M = mod = 998244353

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().split()]

def st():
	return input()

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input()]

def li3():
	return [int(i) for i in input()]
for _ in range(val()):
	(n, k) = li()
	l = li()
	cnt = Counter()
	mins = []
	maxs = []
	sums = []
	arr = [0] * (2 * k + 5)
	for i in range(n // 2):
		cnt[l[i] + l[n - i - 1]] += 1
		(a, b) = (max(l[i], l[n - i - 1]), min(l[i], l[n - i - 1]))
		arr[b] += 1
		arr[a + k] -= 1
		maxs.append(a + k - b)
		mins.append(b + 1)
	mins.sort()
	maxs.sort()
	ans = n
	curr = arr[1]
	for i in range(2, 2 * k + 1, 1):
		onecost = curr - cnt[i]
		twocost = n // 2 - curr
		ans = min(ans, onecost + twocost * 2)
		curr += arr[i]
	print(ans)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from sys import stdout
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	b = {}
	c = [0 for i in range(2 * k + 2)]
	while i < n // 2:
		if b.get(a[i] + a[j]) == None:
			b[a[i] + a[j]] = 1
		else:
			b[a[i] + a[j]] += 1
		c[min(a[i], a[j]) + 1] += 1
		c[max(a[i], a[j]) + k + 1] -= 1
		i += 1
		j -= 1
	for i in range(3, 2 * k + 1):
		c[i] += c[i - 1]
	mi = n
	for i in range(2, 2 * k + 1):
		d = 0
		if b.get(i) != None:
			d = b[i]
		e = c[i] - d
		f = n // 2 - (e + d)
		mi = min(mi, e + 2 * f)
	stdout.write(str(mi) + '\n')


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = [i for i in range(1, n + 1) if i % 2 == 0]
		l1 = [i for i in range(1, n) if i % 2 != 0]
		l3 = l + l1
		last = l3[-1]
		l3.remove(last)
		l3.append(last + n // 2)
		print('YES')
		for i in l3:
			print(i, end=' ')


t = int(input())
inputs = [0] * t
for i in range(t):
	inputs[i] = int(input())
for n in inputs:
	if n % 4 != 0:
		print('NO')
		continue
	m = n // 2
	i = list(range(1, m + 1))
	j = i.copy()
	j[-1] += m // 2
	ans = list(map(lambda o: 2 * o, i)) + list(map(lambda o: 2 * o - 1, j))
	print('YES')
	print(' '.join(map(str, ans)))


t = int(input())
n = []
for j in range(t):
	n.append(int(input()))
for j in range(t):
	answ = ''
	s0 = s1 = 0
	if n[j] % 4 != 0:
		print('NO')
	else:
		a = [0] * (n[j] + 1)
		for i in range(1, n[j] // 2 + 1):
			a[i] = 2 * i
			a[i + n[j] // 2] = 2 * i - 1
			s0 += a[i]
			if i != n[j] // 2:
				s1 += a[i + n[j] // 2]
		a[n[j]] = s0 - s1
		a.pop(0)
		print('YES')
		for i in range(n[j]):
			answ += str(a[i])
			if i < n[j]:
				answ += ' '
		print(answ)


from sys import stdin
import sys
from sys import stdout
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n, k) = gil()
	a = gil()
	z = {}
	pre = [0] * (2 * k + 1)
	pre[0] = n
	for i in range(n // 2):
		z[a[i] + a[n - i - 1]] = z.get(a[i] + a[n - i - 1], 0) + 1
		(l, r) = (1 + min(a[i], a[n - i - 1]), max(a[i], a[n - i - 1]) + k)
		pre[l] -= 1
		if r + 1 <= 2 * k:
			pre[r + 1] += 1
	for i in range(1, 2 * k + 1):
		pre[i] += pre[i - 1]
	idx = min(range(2, 2 * k + 1), key=lambda x: pre[x] - z.get(x, 0))
	print(pre[idx] - z.get(idx, 0))


def fun(a):
	if a % 4 != 0:
		print('NO')
	else:
		l = []
		for i in range(1, a // 2 + 1):
			l.append(i * 2)
		m = sum(l)
		for i in range(0, a // 2 - 1):
			l.append(i * 2 + 1)
		m = 2 * m - sum(l)
		l.append(m)
		print('YES')
		for i in l:
			print(i, end=' ')
		print()
t = int(input())
for _ in range(t):
	i = int(input())
	fun(i)


t = int(input())
for i in range(t):
	n = int(input())
	if int(n % 4) != 0:
		print('NO')
	else:
		l = []
		e = 2
		o = 1
		for j in range(int(n / 2)):
			l.append(e * (j + 1))
		for j in range(int(n / 2) - 1):
			if j == 0:
				l.append(o)
			else:
				l.append(l[len(l) - 1] + 2)
		s = int(n / 2) - 1 + l[int(n / 2) - 1]
		l.append(s)
		ans = ''
		for k in range(len(l)):
			ans += str(l[k])
			ans += ' '
		print('YES')
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		odd = []
		even = []
		cur_ev = 1
		for i in range(n // 4):
			even.append(cur_ev)
			odd.append(cur_ev + 1)
			cur_ev += 4
			even.append(cur_ev)
			odd.append(cur_ev - 1)
			cur_ev += 2
		for el in odd:
			print(el, end=' ')
		for el in even:
			print(el, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		print(*list(range(2, n + 1, 2)), *[x for x in range(1, n + 2, 2) if x != n // 2 + 1])
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = [2 * i for i in range(1, n // 2 + 1)]
		b = [2 * i - 1 for i in range(1, n // 2)]
		c = [2 * (n // 2) + n // 2 - 1]
		print('YES')
		a = a + b + c
		for x in a:
			print(x, end=' ')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		lst = list(range(2, n + 1, 2))
		lst2 = list(range(1, n + 1, 2))
		a = lst2[n // 2 - 1]
		lst2.remove(lst2[n // 2 - 1])
		lst2.append(a + n // 2)
		res_list = map(str, [y for x in [lst, lst2] for y in x])
		print(' '.join(res_list))


from collections import defaultdict
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	d = defaultdict(int)
	cumsum = [0 for i in range(2 * k + 1)]
	cumsum_max = [0 for i in range(2 * k + 1)]
	for i in range(n // 2):
		d[a[i] + a[n - i - 1]] += 1
		cumsum[min(a[i], a[n - i - 1])] += 1
		if max(a[i], a[n - i - 1]) + k + 1 < 2 * k + 1:
			cumsum_max[max(a[i], a[n - i - 1]) + k + 1] += 1
	for i in range(len(cumsum) - 2, 0, -1):
		cumsum[i] += cumsum[i + 1]
	for i in range(1, len(cumsum_max)):
		cumsum_max[i] += cumsum_max[i - 1]
	ans = -1
	for i in range(2, 2 * k + 1):
		pair_count = d[i]
		pair_sum = i
		change = n // 2 - pair_count + cumsum[pair_sum] + cumsum_max[pair_sum]
		ans = change if ans < 0 else min(ans, change)
	print(ans)


class BIT:

	def __init__(self, n):
		self.n = n
		self.bit = [0] * (n + 1)

	def _add(self, i, val):
		while i > 0:
			self.bit[i] += val
			i -= i & -i

	def get_val(self, i):
		i = i + 1
		s = 0
		while i <= self.n:
			s += self.bit[i]
			i += i & -i
		return s

	def add(self, l, r, val):
		self._add(r, val)
		self._add(l, -val)
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = a[n // 2:n][::-1]
	a = a[0:n // 2]
	bit = BIT(2 * k + 1)
	bit.add(0, 2 * k + 1, 2 * n // 2)
	for i in range(n // 2):
		ran = [min(a[i] + 1, b[i] + 1), max(a[i] + k + 1, b[i] + k + 1)]
		bit.add(ran[0], ran[1], -1)
		bit.add(a[i] + b[i], a[i] + b[i] + 1, -1)
	print(min([bit.get_val(i) for i in range(2 * k + 1)]))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		left = [i for i in range(2, n + 1, 2)]
		right = [i for i in range(1, n - 1, 2)]
		right.append(sum(left) - sum(right))
		print(*left, sep=' ', end=' ')
		print(*right, sep=' ')


for _ in range(int(input())):
	v = int(input())
	o = list(range(1, v, 2))
	e = list(range(2, v + 1, 2))
	f = v // 2
	if f % 2 == 0:
		print('YES')
		for i in e:
			print(i, end=' ')
		for i in range(len(o) - 1):
			print(o[i], end=' ')
		print(o[-2] + (f // 2 + 1) * 2, end=' ')
		print()
	else:
		print('NO')


def new(n):
	if n % 4 != 0:
		print('NO')
	else:
		talika1 = []
		talika2 = []
		i = 1
		j = 2
		m = n / 2
		r = 1 + 2 * (m - 1)
		last = int(r + m / 2 * (2 * 2 + 2 * (m - 1)) - m / 2 * (2 * 1 + 2 * (m - 1)))
		for _ in range(int(n / 2)):
			talika1.append(j)
			if i != r:
				talika2.append(i)
			else:
				talika2.append(last)
			i += 2
			j += 2
		print('YES')
		print(*talika1 + talika2, sep=' ')
t = int(input())
for _ in range(t):
	new(int(input()))


t = int(input())
for _ in range(t):
	k = int(input())
	if k % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = [0] * k
		for i in range(k // 4):
			a[i] = i * 2 + 2
			a[k // 2 + i] = i * 2 + 1
		for i in range(k // 4, k // 2):
			a[i] = i * 2 + 2
			a[k // 2 + i] = i * 2 + 3
		print(' '.join(list(map(str, a))))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		evens = [str(i) for i in range(2, n + 1, 2)]
		odds = [str(i) for i in range(1, n, 2)]
		k = n // 2
		odds[-1] = str(k * (k + 1) - (k - 1) ** 2)
		print(' '.join(evens), ' '.join(odds))
	else:
		print('NO')


class Bit:

	def __init__(self, n):
		self.size = n
		self.tree = [0] * (n + 1)
		self.depth = n.bit_length()

	def sum(self, i):
		s = 0
		while i > 0:
			s += self.tree[i]
			i -= i & -i
		return s

	def add(self, i, x):
		while i <= self.size:
			self.tree[i] += x
			i += i & -i

	def lower_bound(self, x):
		sum_ = 0
		pos = 0
		for i in range(self.depth, -1, -1):
			k = pos + (1 << i)
			if k <= self.size and sum_ + self.tree[k] < x:
				sum_ += self.tree[k]
				pos += 1 << i
		return (pos + 1, sum_)
t = int(input())
buf = []
for _ in range(t):
	(n, k) = map(int, input().split())
	aaa = list(map(int, input().split()))
	bit = Bit(2 * k + 1)
	for (a0, a1) in zip(aaa[:n // 2], reversed(aaa[n // 2:])):
		mn = min(a0, a1)
		mx = max(a0, a1)
		sm = a0 + a1
		bit.add(mn + 1, 1)
		bit.add(sm, 1)
		bit.add(sm + 1, -1)
		bit.add(mx + k + 1, -1)
	ans = max((bit.sum(s) for s in range(2, 2 * k + 1)))
	buf.append(n - ans)
print('\n'.join(map(str, buf)))


for u in range(int(input())):
	n = int(input())
	x = n // 2
	(l, d, s) = ([], [], [])
	if x % 2 == 1:
		print('NO')
	else:
		for i in range(1, 1 + n):
			if i % 2 == 0:
				l.append(i)
			else:
				d.append(i)
		d[-1] = d[-1] + x
		s = l + d
		print('YES')
		print(*s)


import math
t = int(input())
for i in range(t):
	n = int(input())
	eve = 2
	odd = 1
	li = []
	if n == 2:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		evesum = 0
		oddsum = 0
		for i in range(n // 2):
			print(eve, end=' ')
			evesum += eve
			eve += 2
		for i in range(n // 2 - 1):
			print(odd, end=' ')
			oddsum += odd
			odd += 2
		print(evesum - oddsum)
	else:
		print('NO')


for t in zip(*[iter([*open(0)][1:])] * 2):
	((n, k), a) = [[*map(int, t.split())] for t in t]
	c = [n] + [0] * k * 2
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		c[x] -= 1
		c[x + y - 1] -= 1
		c[x + y] += 1
		c[k + y] += 1
	for i in range(k * 2):
		c[i + 1] += c[i]
	print(min(c))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		x = n + (n / 2 - 1)
		print(int(x))


def not_valid_number(number: int) -> bool:
	return not number / 2 % 2 == 0

def get_output_number(input_number: int) -> str:
	even_set: list = [2]
	odd_set: list = [1]
	for i in range(3, input_number, 2):
		even_set.append(i + 1)
		odd_set.append(i)
	digit_number = int(input_number / 2)
	odd_set[-1] = digit_number * (digit_number + 1) + odd_set[-1] - sum(odd_set)
	return ' '.join(map(str, even_set + odd_set))

def print_output(array: list):
	for i in array:
		print(i)
result = []
number_of_input: int = int(input())
while number_of_input > 0:
	input_number = int(input())
	if not_valid_number(input_number):
		result.append('NO')
	else:
		result.append('YES')
		result.append(get_output_number(int(input_number)))
	number_of_input -= 1
print_output(result)


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0 and n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				print(i, end=' ')
				sum += i
		print(1, end=' ')
		sum = sum - 1
		n = n // 2 - 1
		f = 3
		while n != 1:
			print(f, end=' ')
			sum = sum - f
			f += 2
			n -= 1
		print(sum)


for _ in range(int(input())):
	n = int(input())
	val = n // 2
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	for i in range(val):
		print((i + 1) * 2, end=' ')
	for i in range(val - 1):
		print(2 * i + 1, end=' ')
	print(3 * val - 1)


import math

def main():
	for q in range(int(input())):
		N = int(input())
		if N // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			start = 2
			cap = 1
			for i in range(N // 2):
				print(start, end=' ')
				start += 4 if cap == 0 else 2
				cap = 0 if cap == 1 else 1
			start = 1
			cap = 0
			for i in range(N // 2):
				print(start, end=' ')
				start += 4 if cap == 0 else 2
				cap = 0 if cap == 1 else 1
			print('')
main()


x = int(input())
for a in range(x):
	y = int(input())
	if y % 4 != 0:
		print('NO')
	else:
		st = ''
		s = 0
		for a in range(2, y + 1, 2):
			st += str(a) + ' '
			s += a
		s1 = 0
		for a in range(1, y - 1, 2):
			st += str(a) + ' '
			s1 += a
		st += str(s - s1)
		print('YES')
		print(st)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		m = n // 2
		for i in range(1, m + 1):
			print(2 * i, end=' ')
		for i in range(0, m - 1):
			print(2 * i + 1, end=' ')
		print(3 * m - 1)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		x = 2
		y = 1
		for j in range(n // 2):
			l.append(x)
			x += 2
		for k in range(n // 2 - 1):
			l.append(y)
			y += 2
		l.append(y + n // 2)
		for m in l:
			print(m, end=' ')
		print()


t = int(input())
n = []
y = []
chet = []
nech = []
for i in range(t):
	n.append(int(input()))
for j in range(1, max(n) + 1):
	y.append(j)
for k in n:
	for u in range(k):
		if y[u] % 2 == 0:
			chet.append(y[u])
		else:
			nech.append(y[u])
	if sum(nech) == sum(chet):
		print('YES')
		print(chet, nech)
		chet = []
		nech = []
	elif sum(nech) < sum(chet):
		if (sum(chet) - sum(nech)) % 2 == 0:
			nech[-1] += sum(chet) - sum(nech)
			print('YES')
			print(*chet, *nech)
			chet = []
			nech = []
		else:
			print('NO')
			chet = []
			nech = []
	elif (sum(chet) - sum(nech)) % 2 != 0:
		print('NO')
		chet = []
		nech = []


x = int(input())
while x != 0:
	x = x - 1
	t = int(input())
	num = t >> 1
	if num & 1:
		print('NO')
	else:
		print('YES')
		st = 2
		evens = []
		odds = []
		while num > 0:
			num = num - 2
			evens.append(st)
			odds.append(st - 1)
			evens.append(st + 2)
			odds.append(st + 3)
			st += 6
		for i in evens:
			print(i, end=' ')
		for i in odds:
			print(i, end=' ')
		print()


import math
for t in range(int(input())):
	n = int(input())
	nn = n // 2
	if nn % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = 2
		for i in range(n // 2):
			print(a, end=' ')
			a += 2
		(a, f) = (1, 1)
		for j in range(n // 2 - 1):
			print(a, end=' ')
			a += 2
			f += 1
		print(a + f)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		j = 0
		print('YES')
		for _ in range(0, n // 4):
			print(j + 2, j + 4, sep=' ', end=' ')
			j += 6
		j = 0
		for _ in range(0, n // 4):
			print(j + 1, j + 5, sep=' ', end=' ')
			j += 6
		print('')
	else:
		print('NO')


t_case = int(input())
while t_case != 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		n //= 2
		evn = list((int(i * 2) for i in range(1, n + 1)))
		odd = list((int(i * 2 - 1) for i in range(1, n + 1)))
		x = odd.pop()
		odd.append(n + x)
		for i in odd:
			evn.append(i)
		for i in evn:
			print(i, end=' ')
		print(' ')
	t_case -= 1


t = int(input())
while t > 0:
	n = int(input())
	a = []
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(1, n // 2 + 1):
			a.append(2 * i)
		j = 0
		even = sum(a)
		for i in range(n // 2 + 1, n):
			a.append(a[j] - 1)
			j += 1
		a.append(even - (sum(a) - even))
		for i in a:
			print(i, end=' ')
		print()
	else:
		print('NO')
	t -= 1


k = int(input())
while k != 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		result = [i for i in range(2, n + 1) if i % 2 == 0]
		result.extend([i for i in range(0, n) if i % 2 == 1])
		result[-1] += n // 2
		for ele in result:
			print(ele, end=' ')
		print()
	k = k - 1


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
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 MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

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

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

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 main():
	t = I()
	l = []
	for _ in range(t):
		n = I()
		a = []
		if n == 2:
			print('NO')
		else:
			for i in range(n // 2):
				a.append((i + 1) * 2)
			sm = sum(a)
			for i in range(n // 2):
				z = i * 2 + 1
				a.append(z)
				sm -= z
			if sm == 0:
				print('YES')
				print(*a)
			else:
				x = a.pop()
				if (sm + x) % 2 == 0:
					print('NO')
				else:
					a.append(sm + x)
					print('YES')
					print(*a)
main()


import sys
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		inc = n // 2
		res = []
		dif = 0
		for i in range(inc):
			res.append(i * 2 + 2)
			dif += i * 2 + 2
		for i in range(inc - 1):
			res.append(i * 2 + 1)
			dif -= i * 2 + 1
		print(' '.join(map(str, res)), dif)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		even = []
		z = 2
		for i in range(n // 2):
			even.append(z)
			z = z + 2
		esum = sum(even)
		odd = []
		z = 1
		for i in range(n // 2 - 1):
			odd.append(z)
			z = z + 2
		lastelem = esum - sum(odd)
		odd.append(lastelem)
		print('YES')
		print(*even, sep=' ', end=' ')
		print(*odd, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	j = 0
	check = n // 2
	if check % 2 is 0:
		a = []
		for i in range(n):
			if i < n / 2:
				a.append(2 * (i + 1))
			elif i is n - 1:
				last = (n * (n + 2) - (n - 2) * (n - 2)) / 4
				last = int(last)
				a.append(last)
			else:
				a.append(2 * j + 1)
				j = j + 1
		print('YES')
		print(*a, sep=' ')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	s = [0] * (2 * k + 2)
	for i in range(n // 2):
		x = a[i]
		y = a[n - i - 1]
		s[2] += 2
		s[min(x, y) + 1] -= 1
		s[max(x, y) + k + 1] += 1
		s[x + y] -= 1
		s[x + y + 1] += 1
	for i in range(2, 2 * k + 2):
		s[i] += s[i - 1]
	print(min(s[2:]))


t = int(input())
for i in range(0, t):
	n = int(input())
	q = n // 2
	r = q % 2
	if r == 0:
		a = []
		for j in range(0, n // 2):
			x = 2 * (j + 1)
			a.append(x)
		for k in range(0, n // 2):
			y = 2 * k + 1
			a.append(y)
		a[n - 1] = a[n - 1] + n // 2
		print('YES')
		print(*a)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('No')
	else:
		s = 0
		print('Yes')
		for i in range(2, n + 1, 2):
			s += i
			print(i, end=' ')
		s1 = 0
		for i in range(1, n - 2, 2):
			s1 += i
			print(i, end=' ')
		print(s - s1)


t = int(input())
for q in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		d = 0
		soma = 0
		for k in range(1, int(n / 2 + 1)):
			print(k * 2, end=' ')
			soma += k * 2
		for i in range(1, int(n / 2)):
			d += i * 2 - 1
			print(i * 2 - 1, end=' ')
		print(soma - d)
	else:
		print('NO')


tests = int(input())
for test in range(tests):
	n = int(input())
	size = int(n / 2)
	even_arr = [2]
	even_sum = 2
	for each in range(1, size):
		value = even_arr[each - 1] + 2
		even_arr.append(value)
		even_sum = even_sum + value
	odd_arr = [1]
	odd_sum = 1
	for each in range(1, size - 1):
		value = odd_arr[each - 1] + 2
		odd_arr.append(value)
		odd_sum = odd_sum + value
	last_num = even_sum - odd_sum
	if last_num in odd_arr or last_num % 2 == 0:
		print('NO')
	else:
		odd_arr.append(last_num)
		arr = even_arr + odd_arr
		result = ' '.join([str(elem) for elem in arr])
		print('YES')
		print(result)


def run():
	n = int(input())
	if n & 1:
		print('NO')
		return
	elif n // 2 & 1:
		print('NO')
		return
	else:
		left = [2 * i for i in range(1, n // 2 + 1)]
		right = [2 * i - 1 for i in range(1, n // 2)]
		right.append(sum(left) - sum(right))
		left += right
		print('YES')
		print(' '.join([str(i) for i in left]))
t = int(input())
for i in range(t):
	run()


for _ in range(int(input())):
	n = int(input())
	num = int(n / 2)
	even = num * (num + 1)
	odd = 1
	sumodd = 0
	lst = []
	c = 0
	flag = 0
	for i in range(num):
		lst.append(c + 2)
		c += 2
	for i in range(num):
		if i == num - 1:
			if even > sumodd:
				if (even - sumodd) % 2 == 1 and lst.count(even - sumodd) == 0:
					print('YES')
					flag = 1
					lst.append(even - sumodd)
				else:
					print('NO')
			else:
				print('NO')
		else:
			lst.append(odd)
			sumodd += odd
			odd += 2
	if flag == 1:
		for i in range(len(lst)):
			if i == len(lst) - 1:
				print(lst[i])
			else:
				print(lst[i], end=' ')


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		l = []
		c = 2
		for w in range(n // 2):
			l.append(c)
			c += 4
		c = 1
		for w in range(0, n // 2, 2):
			l.append(l[w] - 1)
			l.append(l[w + 1] + 1)
		print(' '.join((str(x) for x in l)))


for _ in range(int(input())):
	N = int(input())
	if N // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		(First, Second) = ([2], [3])
		Check = True
		for i in range(N // 2 - 1):
			if Check:
				First.append(First[-1] + 4)
				Second.append(Second[-1] + 2)
			else:
				First.append(First[-1] + 2)
				Second.append(Second[-1] + 4)
			Check = not Check
		print(*First + Second)


t = int(input())
for test in range(t):
	n = int(input())
	delta = n / 2
	if delta % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		delta = n // 2
	o = 1
	e = 2
	odd = []
	even = []
	for i in range(int(delta / 2)):
		odd.append(o)
		even.append(e)
		to = o + 4
		te = e + 2
		odd.append(to)
		even.append(te)
		o += 6
		e += 6
	for i in range(delta):
		even.append(odd[i])
	for i in range(n):
		print(even[i], end=' ')
	print('')


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = 2
		o = 1
		se = 0
		so = 0
		l = []
		for i in range(n // 2):
			l.append(e)
			se += e
			e += 2
		for i in range(n // 2 - 1):
			l.append(o)
			so += o
			o += 2
		sr = se - so
		l.append(sr)
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	L = [n for j in range(n)]
	somme = 0
	for k in range(0, n // 2):
		L[k] = 2 * (k + 1)
		somme += L[k]
	comp = 0
	flag = 0
	for k in range(n // 2, n - 1):
		L[k] = 2 * comp + 1
		comp += 1
		somme -= L[k]
	if somme % 2 != 0:
		L[n - 1] = somme
		flag = 1
	if flag == 0:
		print('NO')
	else:
		print('YES')
		ch = ''
		for i in L:
			ch += str(i) + ' '
		print(ch)


for t in range(int(input().strip())):
	(n, k) = tuple(map(int, input().strip().split()))
	arr = tuple(map(int, input().strip().split()))
	cnt = [0 for i in range(2 * k + 1)]
	pref = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		s = arr[i] + arr[n - 1 - i]
		cnt[s] += 1
		pref[min(arr[i], arr[n - 1 - i]) + 1] += 1
		pref[max(arr[i], arr[n - 1 - i]) + k + 1] -= 1
	ans = n
	for i in range(2, 2 * k + 1):
		pref[i] += pref[i - 1]
		ans = min(ans, n - pref[i] - cnt[i])
	print(ans)


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	mn = [0 for i in range(2 * k + 2)]
	mx = [0 for i in range(2 * k + 2)]
	s = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		s[arr[i] + arr[n - 1 - i]] += 1
		mn[min(arr[i], arr[n - 1 - i]) + 1] += 1
		mx[max(arr[i], arr[n - 1 - i]) + k] += 1
	for i in range(1, 2 * k + 2):
		mn[i] += mn[i - 1]
		mx[i] += mx[i - 1]
	ans = n
	for i in range(1, 2 * k + 1):
		temp = mx[i - 1] + (n // 2 - mn[i])
		temp2 = n // 2 - temp
		temp2 -= s[i]
		ans = min(ans, temp2 + temp * 2)
	print(ans)


from collections import Counter, defaultdict

def get_by(x):
	c = 0
	for i in range(n // 2):
		if x == a[i] + a[n - 1 - i]:
			continue
		if k + a[n - 1 - i] < x:
			c += 2
		else:
			c += 1
	return c
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = defaultdict(int)
	original_counter = Counter()
	one_diff_counter = Counter()
	for i in range(n // 2):
		(x, y) = (a[i], a[n - i - 1])
		original_counter[x + y] += 1
		one_diff_counter[min(x, y) + 1] += 1
		one_diff_counter[max(x, y) + k + 1] -= 1
	one_diff = 0
	minimum_change = float('inf')
	for i in range(2, 2 * k + 1):
		zero_diff = original_counter[i]
		one_diff += one_diff_counter[i]
		two_diff = n - zero_diff - one_diff * 2
		change = one_diff + two_diff
		minimum_change = min(minimum_change, change)
	print(minimum_change)


for _ in range(int(input())):
	n = int(input())
	if not n % 4:
		arr = []
		for x in range(1, n // 2 + 1):
			arr.append(x * 2)
		for x in range(1, n // 2 + 2):
			arr.append(x * 2 - 1)
		arr.remove(n // 2 + 1)
		print('YES')
		print(*arr)
	else:
		print('NO')


ppp = int(input())
for pp in range(0, ppp):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a1 = []
		a2 = []
		dd = 10000000
		ss = 1
		re = 1
		st1 = 0
		st2 = 1
		for i in range(0, n):
			if i % 2 == 0:
				if ss == 1:
					a1.append(dd + st1)
					st1 = st1 + 2
					ss = -1
				else:
					a1.append(dd - st1)
					st1 = st1 + 2
					ss = 1
			elif re == 1:
				a2.append(dd + st2)
				st2 = st2 + 2
				re = -1
			else:
				a2.append(dd - st2)
				st2 = st2 + 2
				re = 1
		print('YES')
		for t in a1:
			print(t, end=' ')
		for t in a2:
			if t == a2[int(n / 2) - 1]:
				print(t)
			else:
				print(t, end=' ')


from collections import *
from sys import *
inp = stdin.readline
flag = 1
if not flag:
	out = stdout.write
	str = str
else:
	out = print

def linp(x):
	return list(map(int, x.split()))

def minp(x):
	return map(int, x.split())
t = int(inp())
while t > 0:
	n = int(inp())
	if n % 2 == 0 and n % 4 == 0:
		even = [2 * i for i in range(1, n // 2 + 1)]
		odd = [0] * (n // 2)
		for i in range(n // 2 - 1):
			odd[i] = even[i] - 1
		odd[-1] = sum(even) - sum(odd)
		out('YES')
		out(*even, *odd)
	else:
		out('NO')
	t -= 1


from collections import Counter
from _collections import defaultdict
import math
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		f = 2
		l = []
		k = 1
		s1 = 0
		s2 = 0
		for i in range(0, n // 2):
			s1 = s1 + f
			l.append(f)
			f = f + 2
		for i in range(0, n // 2 - 1):
			s2 = s2 + k
			l.append(k)
			k = k + 2
		f = f - 2
		k = k - 2
		ans = s1 - s2
		l.append(ans)
		print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		out_even = []
		out_odd = []
		for i in range(n // 4):
			out_even.append(4 * (2 * i) + 2)
			out_even.append(4 * (2 * i) + 4)
			out_odd.append(4 * (2 * i) + 1)
			out_odd.append(4 * (2 * i) + 5)
		out = out_even + out_odd
		print(*out)


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

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

def array():
	return [int(i) for i in input().split()]
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')
for _ in range(int(input())):
	n = int(input())
	k = n // 2
	if k % 2 == 1:
		print('NO')
	else:
		print('YES')
		od = []
		ev = [2 * i for i in range(1, k + 1)]
		c = 1
		for i in range(k - 1):
			od.append(c)
			c += 2
		od.append(sum(ev) - sum(od))
		print(*ev, *od)


t = int(input())
for i in range(t):
	a = int(input())
	if a // 2 % 2 == 0:
		sc = []
		nc = []
		su_sc = 0
		su_nc = 0
		for j in range(1, a + 1):
			if j % 2 == 0:
				sc.append(j)
				su_sc += j
			elif j != a - 1:
				nc.append(j)
				su_nc += j
		nc.append(su_sc - su_nc)
		print('YES')
		for i in range(len(sc)):
			print(sc[i], end=' ')
		for i in range(len(nc)):
			if i != len(nc) - 1:
				print(nc[i], end=' ')
			else:
				print(nc[i])
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = 2
		arr = [0] * n
		for i in range(0, n // 2, 2):
			arr[i] = e
			arr[i + 1] = e + 2
			arr[i + n // 2] = e - 1
			arr[i + n // 2 + 1] = e + 3
			e = e + 6
		print(*arr, sep=' ')


def main():
	t = int(input())
	while t != 0:
		n = int(input())
		k = n // 2
		if k & 1:
			print('NO')
			t -= 1
			continue
		print('YES')
		arr = [2 * i for i in range(1, k + 1)]
		arr2 = [2 * i - 1 for i in range(1, k)]
		arr2.append(3 * k - 1)
		ans = ''
		for x in arr + arr2:
			ans += str(x) + ' '
		print(ans)
		t -= 1
main()


t = int(input())
for i in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('no')
	else:
		print('YEs')
		lst = []
		j = 2
		s = 0
		for i in range(x):
			lst.append(j)
			j += 2
		s = sum(lst)
		j = 1
		d = 0
		z = []
		for i in range(x - 1):
			z.append(j)
			j += 2
		d = sum(z)
		d1 = abs(d - s)
		z.append(d1)
		for i in range(len(z)):
			lst.append(z[i])
		print(*lst)


t = int(input())
for i in range(t):
	s = int(input())
	if s % 4 == 0:
		print('YES')
		lhs = []
		num = 0
		rhs = []
		for j in range(int(s / 2)):
			num += 2
			lhs.append(num)
		num = -1
		for j in range(int(s / 2) - 1):
			num += 2
			rhs.append(num)
		rhs.append(sum(lhs) - sum(rhs))
		lhs.extend(rhs)
		string = ''
		for g in lhs:
			string += str(g) + ' '
		print(string)
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from collections import deque
t = int(input())
for ii in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	ans = []
	for i in range(n // 2):
		ans.append(2 * i + 2)
	s = sum(ans)
	for i in range(n // 2 - 1):
		ans.append(2 * i + 1)
	ans.append(2 * s - sum(ans))
	print(*ans)
sys.exit()
N = 5
es = [[1, 2, 3], [0, 2], [0, 1], [0, 4], [3]]
colors = [0 for i in range(N)]

def dfs(v, color):
	print(v, color)
	colors[v] = color
	for to in es[v]:
		if colors[to] == color:
			return False
		if colors[to] == 0 and (not dfs(to, -color)):
			return False
	return True

def is_bipartite():
	return dfs(0, 1)
print(is_bipartite())


for x in range(int(input())):
	a = int(input())
	l = []
	if a > 2:
		for x in range(1, a // 2 + 1):
			l.append(x * 2)
		for i in range(1, a - 1, 2):
			f = i
			l.append(i)
		if (f + 2 + a // 2) % 2 == 0:
			print('NO')
		else:
			print('YES')
			print(*l, f + 2 + a // 2)
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	l = []
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(2, a + 1, 2):
			l.append(j)
		for k in range(1, a - 1, 2):
			l.append(k)
		l.append(a - 1 + a // 2)
		for m in l:
			print(str(m), end=' ')


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		k = 2
		sum = 0
		for i in range(int(n / 2)):
			sum += k
			print(k, end=' ')
			k += 2
		k = 1
		sum1 = 0
		p = int(n / 2)
		while p > 1:
			sum1 += k
			print(k, end=' ')
			k += 2
			p -= 1
		print(sum - sum1)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		List = [2 * k for k in range(1, 1 + n // 2)] + [2 * k - 1 for k in range(1, n // 2)] + [n + (n - 2) // 2]
		for j in range(len(List) - 1):
			print(List[j], end=' ')
		print(List[len(List) - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	k = 1
	if n <= 2:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
		for j in range(n // 2 + 1, n):
			print(k, end=' ')
			k += 2
		print(k + n // 2)
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = []
	d = int(n / 2)
	i = 1
	while d > 0:
		a.append(2 * i)
		i = i + 1
		d = d - 1
	sum1 = sum(a)
	k = 0
	d = int(n / 2)
	i = 1
	while d > 0:
		if k == n / 2 - 1 and sum1 % 2 != 0:
			if sum1 not in a:
				a.append(sum1)
				sum1 = 0
				k = k + 1
				break
			else:
				break
		elif sum1 >= i:
			sum1 = sum1 - i
			a.append(i)
			k = k + 1
			i = i + 2
			d = d - 1
	if sum1 == 0 and k == n / 2:
		print('YES')
		print(*a)
	else:
		print('NO')


test = int(input())
i = 0
while i < test:
	lst = []
	size = int(input())
	halfSize = size / 2
	if halfSize % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = 0
		factor = 2
		while k < halfSize:
			lst.append(factor * (k + 1))
			k += 1
		k = halfSize
		sum = len(lst) * (len(lst) + 1)
		begin = 1
		oddsum = 0
		while k < size - 1:
			oddsum += begin
			lst.append(begin)
			begin += 2
			k += 1
		lst.append(sum - oddsum)
		for p in lst:
			print(p, end=' ')
		print(end='\n')
	i += 1


n = int(input())
for i in range(n):
	h = list(map(int, input().rstrip().split()))
	N = h[0]
	K = h[1]
	h = list(map(int, input().rstrip().split()))
	t = [0] * (2 * K + 2)
	for i in range(N // 2):
		t[h[i] + h[N - i - 1]] -= 1
		t[h[i] + h[N - i - 1] + 1] += 1
		t[max(h[i], h[N - i - 1]) + K + 1] += 1
		t[min(h[i], h[N - i - 1]) + 1] -= 1
	v = N
	minv = N
	for i in range(2 * K + 2):
		v += t[i]
		if v < minv:
			minv = v
	print(minv)


from sys import stdin, stdout
from math import gcd, sqrt, floor, ceil, log2
from itertools import combinations
input = stdin.readline

def list_inp(x):
	return list(map(x, input().split()))

def map_inp(x):
	return map(x, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		i = 2
		for j in range(n // 2):
			print(i, end=' ')
			i += 2
		arr = []
		for i in range(1, n + 1, 2):
			arr.append(i)
		arr[-1] += n // 2
		print(str(arr).replace(',', '').strip('[').strip(']'))
	else:
		print('NO')


T = int(input())
for i in range(T):
	N = int(input())
	if N / 2 % 2 != 0:
		print('NO')
		continue
	even = list(map(str, range(2, N + 1, 2)))
	odd = list(map(str, range(1, N, 2)))
	odd[-1] = str(int(odd[-1]) + len(odd))
	even.extend(odd)
	s = ' '.join(even)
	print('YES')
	print(s)


import sys
input = sys.stdin.readline
f = lambda : list(map(int, input().split()))
for i in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		inp = [0] * n
		j = 2
		s = 0
		for i in range(n // 2):
			inp[i] = str(j)
			s += j
			j += 2
		s1 = 0
		j = 1
		for i in range(n // 2, n - 1):
			inp[i] = str(j)
			s1 += j
			j += 2
		inp[n - 1] = str(s - s1)
		print(' '.join(inp))


t = int(input())
for _ in range(t):
	a = int(input())
	b = a / 2
	arr2 = [str((x + 1) * 2) for x in range(int(b))]
	total = int(b * (b + 1))
	arr = [str(x * 2 + 1) for x in range(int(b) - 1)]
	arr.append(total - (b - 1) * (b - 1))
	if arr[-1] % 2 == 0:
		print('NO')
	else:
		arr[-1] = str(int(arr[-1]))
		print('YES')
		print(' '.join(arr2) + ' ' + ' '.join(arr))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	arr = [0] * (2 * k + 2)
	count = [0] * (2 * k + 2)
	for i in range(n // 2):
		(x, y) = (min(a[i], a[n - i - 1]), max(a[i], a[n - i - 1]))
		arr[x + 1] -= 1
		arr[y + k + 1] += 1
		count[x + y] += 1
	ans = 10 ** 15
	p = n
	for i in range(2, 2 * k + 1):
		p += arr[i]
		if p - count[i] < ans:
			ans = p - count[i]
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	odd = []
	even = []
	flag = True
	for num in range(1, n + 1):
		if flag == True:
			odd.append(num)
			flag = False
		else:
			even.append(num)
			flag = True
	odd[-1] += n // 2
	even.extend(odd)
	print('YES')
	for num in even:
		print(num, end=' ')
	print()


n = int(input())
for _ in range(n):
	a = int(input())
	s = a // 2
	if s % 2 == 0:
		print('YES')
		for i in range(2, a + 1, 2):
			print(i, end=' ')
		for i in range(1, a - 1, 2):
			print(i, end=' ')
		print(sum(range(2, a + 1, 2)) - sum(range(1, a - 1, 2)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = []
	(sum1, sum2) = (0, 0)
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			l.append(i)
			sum1 += i
		for i in range(1, n - 2, 2):
			l.append(i)
			sum2 += i
		l.append(sum1 - sum2)
	for x in l:
		print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		evens = [2 * x for x in range(1, n // 2 + 1)]
		odds = [2 * x - 1 for x in range(1, n // 2)]
		odds.append(sum(evens) - sum(odds))
		print('YES')
		print(*evens, *odds, sep=' ')


for i in range(int(input())):
	t = int(input())
	if t % 4 != 0:
		print('NO')
		continue
	even = [k for k in range(2, t + 1) if k % 2 == 0]
	odd = [k for k in range(1, t - 1) if k % 2 != 0]
	odd.append(even[-1] + int(t / 2) - 1)
	print('YES')
	print(*even, end=' ')
	print(*odd)


T = int(input())
for case in range(T):
	N = int(input())
	if N % 4 == 0:
		s = str()
		for x in range(2, N + 1, 2):
			s += str(x)
			s += ' '
		for x in range(1, int(N / 2), 2):
			s += str(x)
			s += ' '
		for x in range(int(N / 2 + 3), N + 2, 2):
			s += str(x)
			s += ' '
		print('YES')
		print(s)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1 == 1:
		print('NO')
	else:
		print('YES')
		n //= 2
		l = []
		for i in range(1, n + 1):
			l += [2 * i]
		for i in range(n // 2):
			l += [l[i] - 1]
		for i in range(n // 2, n):
			l += [l[i] + 1]
		for i in l:
			(print(i),)
		print('')


ans = []
for i in range(int(input())):
	m = int(input())
	if m // 2 % 2 == 1:
		ans.append(['NO'])
	else:
		k = 1
		l = 0
		flag = 1
		temp = []
		for _ in range(m // 2):
			temp.append(2 * k)
			k += 1
		for _ in range(m // 2 - 1):
			temp.append(1 + l)
			l += 2
		y = m // 2
		temp.append(abs((y - 1) ** 2 - y * (y + 1)))
		ans.append([flag, temp])
for i in ans:
	if len(i) == 1:
		print(*i)
	else:
		print('YES')
		print(*i[1])


import sys
from collections import deque
t = int(sys.stdin.readline())
for _ in range(t):
	num = int(sys.stdin.readline())
	if num // 2 % 2:
		print('NO')
	else:
		list_result2 = []
		list_result1 = []
		token = 1
		for i in range(2, num * 2 + 1, 4):
			if token:
				list_result1.append(i)
				list_result2.append(i - 1)
				token = 0
			else:
				token = 1
				list_result1.append(i)
				list_result2.append(i + 1)
		print('YES')
		print(*list_result1 + list_result2)


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	if (n // 2 - 1) % 2 == 0:
		print('NO')
	else:
		print('YES')
		ans = []
		a = 2
		for i in range(n // 2):
			ans.append(a)
			a += 2
		ans2 = []
		for i in range(n // 2 - 1):
			ans.append(ans[i] - 1)
		ans2.append(ans[n // 2 - 1] + n // 2 - 1)
		for i in ans:
			print(i, end=' ')
		for i in ans2:
			print(i, end=' ')
		print()


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 == 0:
		a = [0] * n
		ei = 0
		oi = n // 2
		i = 1
		while i <= 3 * (n // 2):
			if i % 3 == 0:
				pass
			elif i % 2 == 0:
				a[ei] = i
				ei = ei + 1
			else:
				a[oi] = i
				oi = oi + 1
			i = i + 1
		print('YES')
		print(' '.join(map(str, a)))
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	a = int(input())
	if a % 4 == 0:
		arr = []
		suma = 0
		for i in range(1, a // 2 + 1):
			arr.append(2 * i)
			suma += 2 * i
		for i in range(1, a // 2):
			arr.append(2 * i - 1)
			suma -= 2 * i - 1
		arr.append(suma)
		print('YES')
		print(' '.join((str(x) for x in arr)))
	else:
		print('NO')


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())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	li = [int(i) for i in input().split(' ')]
	s = {}
	possible = {}
	possible2 = {}
	for i in range(n // 2):
		s[li[i] + li[n - i - 1]] = s.get(li[i] + li[n - i - 1], 0) + 1
		possible[max(li[i], li[n - 1 - i]) + k] = possible.get(max(li[i], li[n - 1 - i]) + k, 0) + 1
		possible2[min(li[i], li[n - 1 - i]) + 1] = possible2.get(min(li[i], li[n - 1 - i]) + 1, 0) + 1
	pl = sorted(possible)
	pl2 = sorted(possible2)
	sl = sorted(s)
	m = int(1000000.0)
	pref = 0
	suff = n // 2
	plidx = 0
	plidx2 = 0
	for i in sl:
		while plidx < len(pl) and i > pl[plidx] or (plidx2 < len(pl2) and i >= pl2[plidx2]):
			if plidx2 >= len(pl2):
				m = min(m, n // 2 + pref - s.get(pl[plidx], 0) + suff)
				pref += possible[pl[plidx]]
				plidx += 1
				continue
			elif plidx >= len(pl):
				suff -= possible2[pl2[plidx2]]
				m = min(m, n // 2 + pref - s.get(pl2[plidx2], 0) + suff)
				plidx2 += 1
			elif plidx2 < len(pl2) and pl[plidx] > pl2[plidx2]:
				suff -= possible2[pl2[plidx2]]
				m = min(m, n // 2 + pref - s.get(pl2[plidx2], 0) + suff)
				plidx2 += 1
				continue
			elif plidx < len(pl) and pl[plidx] < pl2[plidx2]:
				m = min(m, n // 2 + pref - s.get(pl[plidx], 0) + suff)
				pref += possible[pl[plidx]]
				plidx += 1
				continue
			else:
				if not plidx < len(pl) and plidx2 < len(pl2):
					break
				suff -= possible2[pl2[plidx2]]
				m = min(m, n // 2 + pref - s.get(pl2[plidx2], 0) + suff)
				plidx2 += 1
				pref += possible[pl[plidx]]
				plidx += 1
		m = min(m, n // 2 + pref - s[i] + suff)
	print(m)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		k = n // 2
		if k % 2 != 0:
			print('NO')
		else:
			print('YES')
			s = 0
			for i in range(1, k + 1):
				s += i * 2
				print(i * 2, end=' ')
			for i in range(k - 1):
				print(2 * i + 1, end=' ')
				s -= i * 2 + 1
			print(s)
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		c1 = 2
		for i in range(n // 2):
			l.append(c1)
			c1 += 2
		s1 = sum(l)
		c1 = 1
		s2 = 0
		for i in range(n // 2 - 1):
			l.append(c1)
			s2 = s2 + c1
			c1 += 2
		l.append(s1 - s2)
		print(*l)


from sys import stdin

def help():
	stri = stdin.readline().strip('\n')
	n = int(stri)
	if n // 2 % 2 == 1:
		print('NO')
		return
	temp = n // 2
	print('YES')
	for i in range(1, temp + 1):
		print(2 * i, end=' ')
	for i in range(1, temp):
		print(2 * i - 1, end=' ')
	print(3 * temp - 1)
for i in range(int(stdin.readline())):
	help()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('No')
	else:
		print('Yes')
		a = []
		for i in range(1, 1 + n // 2):
			a.append(2 * i)
		for i in range(1, n // 2):
			a.append(2 * i - 1)
		a.append(2 * (i + 1) - 1 + n // 2)
		for i in a:
			print(i, end=' ')
	print()


import math

def YES_or_NO(n):
	i = 2
	j = 1
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		x = int(n / 2)
		while i < n + 1:
			print(i, end=' ')
			i += 2
		while j < n - 1:
			print(j, end=' ')
			j += 2
		print(2 * int(x * (x + 1) / 2) - pow(x - 1, 2))
t = int(input())
for i in range(t):
	n = int(input())
	YES_or_NO(n)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = n // 2
		j = 2
		lis = []
		for i in range(k):
			lis.append(j)
			j = j + 2
		j = 1
		for i in range(k - 1):
			lis.append(j)
			j = j + 2
		lis.append(j + k)
		print(*lis, sep=' ')


test = int(input())
for i in range(0, test):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		dem = 2
		tong = 0
		for j in range(0, int(n / 2)):
			print(dem, end=' ')
			tong = tong + dem
			dem = dem + 2
		dem = 1
		for j in range(0, int(n / 2) - 1):
			print(dem, end=' ')
			tong = tong - dem
			dem = dem + 2
		print(tong)


for t in range(int(input())):
	n = int(input())
	(e, o) = ([], [])
	if n // 2 % 2:
		print('NO')
	else:
		for i in range(1, n // 2 + 1):
			e.append(i * 2)
			o.append(i * 2 - 1)
		o[-1] += sum(e) - sum(o)
		e.extend(o)
		print('YES')
		print(*e)


t = int(input())
y = []
for x in range(t):
	y.append(int(input()))
for i in y:
	if i // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		val = [2, 4, 1, 5]
		arr = [0 * t for t in range(i)]
		for (m, n) in zip(range(0, i // 2 - 1, 2), range(i // 2, i - 1, 2)):
			arr[m] = val[0]
			m += 1
			arr[m] = val[1]
			arr[n] = val[2]
			n += 1
			arr[n] = val[3]
			for k in range(0, 4):
				val[k] += 6
		for p in arr:
			print(p, end=' ')
		print('\r')


from sys import stdin
input = stdin.readline
for i in range(int(input())):
	n = int(input())
	c = 0
	rem = n // 2
	if rem % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			c += 1
		for i in range(1, n - 2, 2):
			print(i, end=' ')
		print(n + c - 1)


n = int(input())
for _ in range(n):
	num = int(input())
	if num % 4 != 0:
		print('NO')
		continue
	print('YES')
	evn_half = []
	odd_half = []
	for i in range(2, num + 1, 2):
		evn_half.append(i)
		odd_half.append(i - 1 if i <= num // 2 else i + 1)
	res = evn_half + odd_half
	for i in res:
		print(i, end=' ')
	print()


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 solve():
	n = int(inp())
	if n % 4 == 0:
		print('YES')
		s = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			s += i
		for i in range(1, n - 1, 2):
			print(i, end=' ')
			s -= i
		print(s)
	else:
		print('NO')
testcase(int(inp()))


test = int(input())
for i in range(test):
	value = int(input())
	n = value // 2
	even = n * (n + 1)
	odd = n * n
	diff = abs(even - odd)
	if diff % 2 == 0:
		print('YES')
		for k in range(2, value + 1, 2):
			print(k, end=' ')
		for j in range(1, value - 1, 2):
			print(j, end=' ')
			value = j + 2
		print(value + diff)
	else:
		print('NO')


def solution(n):
	print('YES')
	even = []
	ole = 2
	for _ in range(cnt):
		even.append(ole)
		ole += 2
	odd = []
	ele = 1
	for _ in range(cnt - 1):
		odd.append(ele)
		ele += 2
	odd.append(sum(even) - sum(odd))
	ans = even + odd
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	cnt = n // 2
	if cnt % 2 != 0:
		print('NO')
	else:
		print(*solution(cnt))


def solve(n):
	global arr
	if n % 4:
		return False
	arr = [-1] * n
	for i in range(n >> 1):
		arr[i] = (i << 1) + 2
	k = 1
	M = set()
	for i in range(0, n >> 1, 2):
		su = arr[i] + arr[i + 1]
		while k in M or su - k in M:
			k += 2
		arr[i + (n >> 1)] = k
		arr[i + (n >> 1) + 1] = su - k
		M.add(k)
		M.add(su - k)
	return True
arr = list()
for _ in range(int(input())):
	n = int(input())
	ans = solve(n)
	print('YES') if ans else print('NO')
	if ans:
		print(*arr)


for i in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		for x in range(2, n + 2, 2):
			print(x, end=' ')
		c = n // 2
		a = c ** 2 + c
		somme = 0
		for x in range(1, n - 1, 2):
			print(x, end=' ')
			somme += x
		print(a - somme)
	else:
		print('NO')


t = int(input())
cnt = 0
for cnt in range(t):
	n = int(input())
	p = n // 2
	if p % 2 != 0:
		print('NO')
	else:
		a = [0] * p
		b = [0] * p
		sum_a = 0
		sum_b = 0
		for i in range(len(a)):
			if i == 0:
				a[i] = 2
			else:
				a[i] = a[i - 1] + 2
			sum_a += a[i]
		for i in range(len(b) - 1):
			if i == 0:
				b[i] = 1
			else:
				b[i] = b[i - 1] + 2
			sum_b += b[i]
		b[i + 1] = sum_a - sum_b
		c = a + b
		print('YES')
		print(*c)


for _ in range(int(input())):
	v = int(input())
	b = v // 2
	if b % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, 2 * b + 1, 2):
			print(i, end=' ')
		c = 1
		i = 1
		while b > c:
			print(i, end=' ')
			i = i + 2
			c = c + 1
		print(i + b)


for _ in range(int(input())):
	n = int(input())
	k = n // 2
	if n % 4 == 0:
		print('YES')
		t = 2
		s = 0
		for _ in range(n // 2):
			print(t, end=' ')
			t += 2
		t = 1
		for _ in range(n // 2 - 1):
			print(t, end=' ')
			s += t
			t += 2
		print(k * (k + 1) - s, end=' ')
		print('')
	else:
		print('NO')


def evenArray(n):
	l1 = []
	l2 = []
	for i in range(n // 2):
		l1.append((i + 1) * 2)
	for i in range(n // 2 - 1):
		l2.append(l1[i] - 1)
	l2.append(sum(l1) - sum(l2))
	return l1 + l2
l = []
for _ in range(int(input())):
	x = int(input())
	if x // 2 % 2 != 0:
		l.append('NO')
	else:
		l4 = []
		l4 = evenArray(x)
		l.append('YES')
		l.append(l4)
for i in l:
	if i == 'NO':
		print(i)
	elif i == 'YES':
		print(i)
	else:
		print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		for x in range(2, n, 2):
			print(x, end=' ')
		print(n + 2, end=' ')
		for x in range(1, n - 1, 2):
			print(x, end=' ')
		print(3 * (n // 2) + 1)


t = int(input())
for i in range(t):
	n = int(input())
	even = []
	odd = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		c = 0
		c1 = 0
		for i in range(1, n // 2 + 1):
			ins = 2 * i
			even.append(ins)
			c += ins
		for j in range(1, n // 2):
			ins1 = 2 * j - 1
			odd.append(ins1)
			c1 += ins1
		odd.append(c - c1)
		print('YES')
		final = even + odd
		print(*final)


for t in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	v = []
	for i in range(1, n // 2 + 1):
		v.append(2 * i)
		a = a + 2 * i
	for i in range(1, n // 2 + 1):
		v.append(2 * i - 1)
		b = b + 2 * i - 1
	if abs(a - b) % 2 == 0:
		if a > b:
			v[-1] = v[-1] + abs(a - b)
		if b > a:
			v[n // 2 - 1] = v[n // 2] + abs(a - b)
	else:
		if a > b:
			v[-1] = v[-1] + abs(a - b) + 1
		if b > a:
			v[n // 2 - 1] = v[n // 2] + abs(a - b)
	if sum(v[0:n // 2]) == sum(v[n // 2:]):
		print('YES')
		for i in v:
			print(i, end=' ')
	else:
		print('NO')


t = int(input())
l = []
for i in range(t):
	m = int(input())
	l.append(m)
for i in l:
	if i % 4 == 2:
		print('NO')
	else:
		print('YES')
		x = []
		y = []
		for j in range(int(i / 2)):
			x.append(2 * j + 2)
			y.append(2 * j + 1)
		y.pop(-1)
		z = sum(x) - sum(y)
		y.append(z)
		m = x + y
		for i in m:
			if i == z:
				print(i)
			else:
				print(i, end=' ')


n = int(input())
for i in range(n):
	a = int(input())
	lis = [a]
	ar1 = []
	ar2 = []
	if a % 4 == 0:
		print('YES')
		x = 0
		y = 0
		for j in range(1, a // 2 + 1):
			ar1.insert(x, j * 2)
			x += 1
		for k in range(1, a // 2):
			ar2.insert(y, k * 2 - 1)
			y += 1
		su = [sum(ar1) - sum(ar2)]
		lis = ar1 + ar2 + su
		print(*lis)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	x = int(n / 2)
	if x % 2 != 0:
		print('NO')
	else:
		k = 0
		out = []
		print('YES')
		for j in range(2, 2 * x + 1, 2):
			out.insert(k, j)
			print(out[k])
			k += 1
		for j in range(int(x / 2)):
			out.insert(k, out[k - x] - 1)
			print(out[k])
			k += 1
		for j in range(int(x / 2)):
			out.insert(k, out[k - x] + 1)
			print(out[k])
			k += 1


testcase = int(input())
for t in range(testcase):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		ret_str = ''
		for i in range(1, int(n / 2) + 1):
			ret_str += str(i * 2) + ' '
		for i in range(1, int(n / 2)):
			ret_str += str((i - 1) * 2 + 1) + ' '
		ret_str += str(n - 1 + int(n / 2))
		print(ret_str)
	else:
		print('NO')


a = int(input())
for i in range(a):
	inp = int(input())
	array = []
	even_sum = 0
	odd_sum = 0
	if inp == 2 or inp / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(2, inp + 1, 2):
			array += [j]
			even_sum += j
		for l in range(1, inp - 1, 2):
			array += [l]
			odd_sum += l
		total_sum = even_sum - odd_sum
		array += [total_sum]
		array = str(array).replace('[', '')
		array = str(array).replace(']', '')
		array = str(array).replace(',', ' ')
		print(array)


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	count0 = [0] * (2 * k + 1)
	pre_arr = [0] * (2 * k + 2)
	for i in range(n // 2):
		p1 = arr[i]
		p2 = arr[n - i - 1]
		l = min(p1, p2) + 1
		r = max(p1, p2) + k
		count0[p1 + p2] += 1
		pre_arr[l] += 1
		pre_arr[r + 1] -= 1
	for i in range(1, 2 * k + 2):
		pre_arr[i] += pre_arr[i - 1]
	ans = float('INF')
	for i in range(2, 2 * k + 1):
		c0 = count0[i]
		c1 = pre_arr[i] - c0
		c2 = n // 2 - c0 - c1
		ans = min(ans, c1 + 2 * c2)
	print(ans)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
t = nextInt()
for _ in range(t):
	n = nextInt()
	if n % 4 != 0:
		print('NO')
		continue
	a = []
	i = 0
	while len(a) < n // 2:
		i += 2
		a.append(i)
	b = []
	for i in range(len(a)):
		if i < n // 4:
			b.append(a[i] - 1)
		else:
			b.append(a[i] + 1)
	print('YES')
	print(' '.join(map(str, a + b)))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		ansl = [2 * i for i in range(1, n // 2 + 1)]
		ansr = [2 * i - 1 for i in range(1, n // 2)]
		ansr.append(2 * n // 2 + n // 2 - 1)
		ans = ansl + ansr
		print('YES')
		print(' '.join((str(i) for i in ans)))


import atexit
import io
import sys
input = sys.stdin.readline
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = []
		a = 0
		c = 0
		b = 0
		for i in range(2, n + 1, 2):
			a += i
			l.append(i)
		for i in range(1, n + 2, 2):
			if i == n - 1:
				continue
			c += 1
			if c == n // 2:
				l.append(a - b)
				continue
			b += i
			l.append(i)
		print('YES')
		print(*l)


def main():
	for _ in range(int(input())):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			ans = []
			ch = 2
			summch = 0
			summn = 0
			for i in range(n // 2):
				ans.append(ch)
				summch += ch
				ch += 2
			ch = 1
			for j in range(n // 2 - 1):
				ans.append(ch)
				summn += ch
				ch += 2
			ans.append(summch - summn)
			print(*ans)
main()


from math import *
test = int(input())
for test_case in range(test):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pre = [0 for i in range(2 * k + 2)]
	d = [0 for i in range(2 * k + 1)]
	for i in range(n // 2):
		d[a[i] + a[n - i - 1]] += 1
		st = min(a[i], a[n - i - 1]) + 1
		en = max(a[i], a[n - i - 1]) + k
		pre[st] += 1
		pre[en + 1] -= 1
	for i in range(1, 2 * k + 2):
		pre[i] += pre[i - 1]
	ans = n // 2
	for i in range(2, 2 * k + 1):
		ct = pre[i] + 2 * (n // 2 - pre[i]) - d[i]
		ans = min(ans, ct)
	print(ans)


import math
t = int(input())
while t:
	n = int(input())
	a = []
	if n % 4 == 0:
		print('YES')
		x = 2
		for i in range(n // 2):
			a.append(x)
			print(x, end=' ')
			x = x + 2
		res = sum(a)
		a = []
		x = 1
		for i in range(n // 2 - 1):
			a.append(x)
			print(x, end=' ')
			x = x + 2
		print(res - sum(a))
	else:
		print('NO')
	t = t - 1


t = int(input())
for i in range(0, t):
	n = int(input())
	(even, odd) = ([], [])
	(a, b) = (1, 2)
	if n // 2 % 2 == 1 or n % 2 == 1:
		print('NO')
	else:
		for i in range(0, n // 2 - 1):
			even.append(b)
			odd.append(a)
			a += 2
			b += 2
		even.append(b)
		a = sum(even) - sum(odd)
		odd.append(a)
		print('YES')
		for i in even:
			print(i, end=' ')
		for i in odd:
			print(i, end=' ')
		print()


T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		even = []
		odd = []
		i = 1
		while len(odd) < n // 2:
			even.append(i * 2)
			even.append(i * 2 + 4)
			odd.append(i * 2 + 1)
			odd.append(i * 2 + 3)
			i += 3
		ans = even + odd
		print(' '.join(map(str, ans)))


t = int(input())
for rew in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		n //= 2
		pocz = [2 * (i + 1) for i in range(n)]
		kon = [2 * i + 1 for i in range(n - 1)]
		dod = sum(pocz) - sum(kon)
		odp = pocz + kon + [dod]
		print(*odp)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
	for j in range(n):
		if n / 2 % 2 != 0:
			print('NO', end='')
			break
		elif j < n / 2:
			print(2 * j + 2, end=' ')
		elif j == n - 1:
			print(n // 2 * (n // 2 + 1) - (n // 2 - 1) * (n // 2 - 1), end=' ')
		else:
			print(2 * (j - n // 2) + 1, end=' ')
	print()


import sys
put = sys.stdin.readline
t = int(put())
while t:
	t -= 1
	n = int(put())
	if n % 4:
		print('NO')
	else:
		print('YES')
		num1 = [i for i in range(2, n + 1, 2)]
		num2 = [i for i in range(1, n - 1, 2)]
		num = num1 + num2 + [sum(num1) - sum(num2)]
		print(' '.join([str(i) for i in num]))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	if n % 2 != 0 or n / 2 % 2 != 0:
		print('NO')
	else:
		for i in range(n // 2):
			arr.append(2 * (i + 1))
		for i in range(n // 2 - 1):
			arr.append(2 * (i + 1) - 1)
		arr.append(sum(arr[:n // 2]) - sum(arr[n // 2:]))
		print('YES')
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = [2 * i for i in range(1, n // 2 + 1)]
		li = []
		for i in range(len(l) - 1):
			li.append(l[i] - 1)
		li.append(sum(l) - sum(li))
		l.extend(li)
		print(*l)


T = int(input())
for t in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	flag = True
	cur = 2
	for i in range(n // 2):
		print(cur, end=' ')
		if flag:
			cur += 2
		else:
			cur += 4
		flag = not flag
	cur = 1
	flag = True
	for i in range(n // 2):
		print(cur, end=' ')
		if flag:
			cur += 4
		else:
			cur += 2
		flag = not flag
	print()


def main():
	for _ in range(int(input())):
		n = int(input().strip())
		if n // 2 % 2:
			print('NO')
		else:
			arr = [2 * i for i in range(1, n // 2 + 1)]
			accu = 0
			for i in range(n // 2 - 1):
				arr.append(arr[i] - 1)
				accu += 1
			arr.append(arr[n // 2 - 1] + accu)
			print('YES')
			last = arr.pop(-1)
			for i in arr:
				print(i, end=' ')
			print(last)
main()


t = int(input())
n = []
for x in range(t):
	n.append(int(input()))
for x in range(t):
	val = n[x]
	if val % 4 != 0:
		print('NO')
	else:
		e = [2 * x for x in range(1, int(val / 2) + 1)]
		o1 = [elem - 1 for elem in e[:int(val / 4)]]
		o2 = [elem + 1 for elem in e[int(val / 4):]]
		list = e + o1 + o2
		ans = ' '.join((str(e) for e in list))
		print('YES\n', ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	print('YES')
	ans1 = [2 * i for i in range(1, n // 2 + 1)]
	ans2 = [2 * i - 1 for i in range(1, n // 2)]
	last = sum(ans1) - sum(ans2)
	ans1 += ans2
	ans1.append(last)
	print(*ans1)


t = int(input())
while t > 0:
	x = int(input())
	nev = 2 + (x // 2 - 1) * 2
	sumev = (nev + 2) // 2 * (x // 2)
	sumod = 0
	k = 1
	l2 = []
	for i in range(1, x // 2 + 1):
		if i < x // 2:
			sumod += k
			l2.append(k)
		if i == x // 2:
			if (sumev - sumod) % 2 != 0:
				l2.append(sumev - sumod)
				sumod += sumev - sumod
			else:
				l2.append(0)
		k = k + 2
	if 0 in l2:
		print('NO')
	if sumev == sumod:
		print('YES')
		z = 2
		l1 = []
		for i in range(x // 2):
			l1.append(z)
			z += 2
		print(*l1 + l2)
	t = t - 1


def solve():
	n = int(input())
	if n % 4 != 0:
		return ['NO']
	q = ' '.join([str(i) for i in list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [n + n // 2 - 1]])
	return ['YES', q]
t = int(input())
ans = []
while t:
	y = solve()
	ans.append(y[0])
	if len(y) == 2:
		ans.append(y[1])
	t -= 1
print('\n'.join(ans))


s = int(input())
for i in range(s):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(n // 2):
			print(2 * (j + 1))
		for j in range(n // 2 - 1):
			print(2 * (j + 1) - 1)
		print(n - 1 + n // 2)


t = int(input())
for _ in range(t):
	n = int(input())
	n = n // 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = [0] * n * 2
		l[0] = 2
		for i in range(1, n):
			l[i] = l[i - 1] + 2
			l[n + i - 1] = l[i - 1] - 1
		l[-1] = l[-2] + 2 + n
		print(' '.join([str(x) for x in l]))


for __ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(2, n + 1, 2):
			l.append(i)
		for i in range(1, n + 1, 2):
			l.append(i)
		l[-1] += n // 2
		print(*l)


n = int(input())
m = [int(input()) for _ in range(n)]
res = []
for i in range(n):
	k = []
	if m[i] % 4 != 0:
		res.append('NO')
	else:
		res.append('YES')
		odd = [str(item) for item in range(1, m[i] - 1, 2)]
		even = [str(item) for item in range(2, m[i] + 1, 2)]
		k.append(even + odd + [str(int(odd[-1]) + 2 + len(even))])
	if k:
		res.append(' '.join(k[0]))
for item in res:
	if item:
		if isinstance(item, str):
			print(item)
		else:
			print(item[0])


t = int(input())
for i in range(t):
	n = int(input())
	p = n // 2
	s = 0
	m = 1
	if p % 2 == 0:
		print('YES')
		for i in range(p):
			s = s + 2
			print(s, end=' ')
		print(m, end=' ')
		for i in range(1, p - 1):
			m = m + 2
			print(m, end=' ')
		print(p * 3 - 1)
	else:
		print('NO')


for n in map(int, [*open(0)][1:]):
	n //= 2
	if n % 2:
		print('NO')
		continue
	print('YES')
	a = [i * 4 for i in range(4, n + 4)]
	a += [i * 4 + (1, -1)[i % 2] for i in range(4, n + 4)]
	print(*a)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		os = es = 0
		even = 2
		odd = 1
		for i in range(n // 2):
			print(even, end=' ')
			es += even
			even += 2
		for i in range(n // 2 - 1):
			print(odd, end=' ')
			os += odd
			odd += 2
		print(es - os)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		x = n // 2
		odd = []
		even = []
		so = 0
		i = 1
		leng = n // 2
		while len(odd) != leng:
			odd.append(i)
			so += i
			i += 2
		se = 0
		i = 2
		while len(even) != leng:
			even.append(i)
			se += i
			i += 2
		if so < se:
			so -= odd[-1]
			odd[-1] = se - so
		for num in even:
			print(num, end=' ')
		for num in odd:
			print(num, end=' ')
		print('\n', end='')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	if a >> 1 & 1:
		print('NO')
	else:
		print('YES')
		l = []
		t = a // 2
		j = 2
		for i in range(t):
			l.append(j)
			j += 2
		t = a // 2
		s = t * (t + 1)
		f = 1
		for i in range(t, a - 1):
			l.append(f)
			f += 2
		l.append(s - (t - 1) ** 2)
		print(*l)


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		e = []
		o = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				e.append(i)
			else:
				o.append(i)
		del o[-1]
		o.append(e[-1] + len(e) - 1)
		s = ' '.join(list(map(str, e)))
		s += ' '
		s += ' '.join(list(map(str, o)))
		print(s)
	else:
		print('NO')
	t -= 1


import math
num_case = int(input())
for i in range(num_case):
	k = int(input())
	con = int(k / 2)
	if con % 2 == 1:
		print('NO')
	else:
		print('YES')
		result = []
		count1 = 0
		count2 = 0
		for i in range(1, con + 1):
			result.append(2 * i)
			count1 += 2 * i
		for i in range(1, con):
			result.append(2 * i - 1)
			count2 += 2 * i - 1
		result.append(count1 - count2)
		for l in result:
			print(l, end=' ')


def main():
	n = int(input())
	if n % 4:
		print('NO')
		return
	(odds, evens) = ([], [])
	for i in range(2, n + 1, 2):
		evens.append(i)
	for i in range(1, n - 1, 2):
		odds.append(i)
	odds.append(sum(evens) - sum(odds))
	print('YES')
	for c in evens:
		print(c, end=' ')
	for c in odds:
		print(c, end=' ')
	print('')
for _ in range(int(input())):
	main()


t = int(input())
while t:
	n = int(input())
	a = [0] * n
	i = 0
	j = n // 2
	dif = 0
	if n == 2:
		print('NO')
	while i <= n // 2 - 1 and j < n:
		if i == 0 and j == n // 2:
			a[i] = 2
			a[j] = 1
			dif += 1
		elif j == n - 1 and i == n // 2 - 1 and ((a[i - 1] + dif) % 2 == 0):
			print('NO')
			break
		elif j == n - 1 and i == n // 2 - 1 and ((a[i - 1] + dif) % 2 != 0):
			a[i] = 2 + a[i - 1]
			a[j] = a[i] + dif
			print('YES')
			print(' '.join(map(str, a)))
			break
		else:
			a[i] = a[i - 1] + 2
			a[j] = a[j - 1] + 2
			dif += 1
		i += 1
		j += 1
	t -= 1


t = int(input())
for i in range(t):
	a = []
	b = []
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(int(n / 2)):
			print(2 * (j + 1), end=' ')
			a.append(2 * (j + 1))
		for j in range(int(n / 2) - 1):
			print(2 * (j + 1) - 1, end=' ')
			b.append(2 * (j + 1))
		print(2 * int(n / 2) - 1 + int(n / 2))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		arr = []
		evenSum = 0
		oddSum = 0
		for i in range(n):
			if i < n // 2:
				evenSum += 2 * (i + 1)
				arr.append(2 * (i + 1))
			elif i < n - 1:
				oddSum += 2 * (i - n // 2) + 1
				arr.append(2 * (i - n // 2) + 1)
			elif i == n - 1:
				arr.append(evenSum - oddSum)
		print('YES')
		print(*arr)


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2
	if k % 2 == 0 and n % 4 == 0:
		print('YES')
		a = 1
		b = 2
		sumb = 0
		suma = 0
		for i in range(k):
			sumb += b
			print(b, end=' ')
			b += 2
		for i in range(k):
			suma += a
			print(a, end=' ')
			if i == k - 2:
				a = sumb - suma
			else:
				a += 2
		print()
	else:
		print('NO')


from collections import *
for t in zip(*[iter([*open(0)][1:])] * 2):
	((n, k), a) = [[*map(int, t.split())] for t in t]
	c = defaultdict(list)
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		c[x + 1] += (-1,)
		c[x + y] += (-1,)
		c[x + y + 1] += (1,)
		c[k + y + 1] += (1,)
	m = t = n
	for i in range(2, k * 2 + 1):
		for j in c[i]:
			t += j
		if t < m:
			m = t
	print(m)


for _ in range(int(input())):
	x = int(input())
	if x <= 2:
		print('NO')
	elif int(x / 2) % 2 == 0:
		print('YES')
		add = 0
		add2 = 0
		for i in range(2, x + 1, 2):
			add += i
			print(i, end=' ')
		for i in range(1, x - 1, 2):
			add2 += i
			print(i, end=' ')
		print(add - add2)
	else:
		print('NO')


n = int(input())
for _ in range(n):
	s = int(input())
	A = []
	if s % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, s // 2 + 1):
			A.append(2 * i)
		for i in range(1, s // 2):
			A.append(2 * i - 1)
		A.append(int(s + s // 2 - 1))
		print(' '.join((str(elem) for elem in A)))


for t in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = []
		s = 0
		for i in range(1, n // 2 + 1):
			a.append(2 * i)
			s += 2 * i
		j = 1
		o = 0
		for i in range(n // 2 + 1, n):
			a.append(j)
			o += j
			j += 2
		a.append(s - o)
		print('YES')
		print(*a)


t = int(input())
while t:
	t += -1
	n = int(input())
	tmp = n // 2
	if tmp % 2:
		print('NO')
		continue
	else:
		print('YES')
		c = 2
		sm = 0
		for i in range(tmp):
			sm += c
			print(c, end=' ')
			c += 2
		c = 1
		for i in range(tmp - 1):
			sm -= c
			print(c, end=' ')
			c += 2
		print(sm)


T = int(input())
for t in range(T):
	N = int(input())
	s = N * (N + 1) // 2
	if s % 2 == 1:
		print('NO')
	else:
		a = []
		s1 = 0
		for n in range(1, N // 2 + 1):
			s1 += 2 * n
			a.append(2 * n)
		s2 = 0
		for n in range(1, N // 2):
			s2 += 2 * n - 1
			a.append(2 * n - 1)
		a.append(s1 - s2)
		print('YES')
		for x in a:
			print(x, end=' ')
		print()


for _ in range(int(input())):
	ar = []
	ar1 = []
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			ar.append(i)
		for i in range(1, n + 1, 2):
			if len(ar1) != n // 2 - 1:
				ar1.append(i)
			else:
				ar1.append(i + ar[-1] // 2)
	print(*ar, end=' ')
	print(*ar1)


t = int(input())
for k in range(t):
	n = int(input())
	if n % 4 == 0:
		a = []
		for i in range(1, n // 2 + 1):
			a.append(2 * i)
		s = sum(a)
		for i in range(1, n // 2):
			a.append(2 * i - 1)
		a.append(2 * s - sum(a))
		print('YES')
		print(*a)
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4 == 0:
		print('YES')
		m = n // 2
		l = []
		n = []
		a = 2
		l.append(a)
		b = 1
		n.append(b)
		k = 0
		s = 0
		for _ in range(1, m):
			a += 2
			l.append(a)
		for _ in range(1, m - 1):
			b += 2
			n.append(b)
		for i in l:
			s += i
		for i in n:
			k += i
		n.append(s - k)
		for i in l:
			print(i, end=' ')
		for i in n:
			print(i, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n & 3:
		print('NO')
		continue
	(a, b) = ([], [])
	for i in range(n // 4):
		a.append(2 + 6 * i)
		a.append(4 + 6 * i)
		b.append(1 + 6 * i)
		b.append(5 + 6 * i)
	print('YES')
	print(*a, *b)


for _ in range(int(input())):
	n = int(input())
	s = n // 2
	if s % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		evens = [i * 2 for i in range(1, s + 1)]
		se = sum(evens)
		odds = [2 * i - 1 for i in range(1, s)]
		last = se - sum(odds)
		odds.append(last)
		print(*evens, *odds)


t = int(input())
for _ in range(t):
	x = int(input())
	h = x // 2
	if h % 2 == 1:
		print('NO')
		continue
	print('YES')
	out = [2 + i * 2 for i in range(h)] + [1 + i * 2 for i in range(h)]
	out[-1] += h
	print(' '.join((str(c) for c in out)))


t = int(input())
for _ in range(t):
	even = []
	odd = []
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if i % 2 == 0:
				odd.append(str(i + 1))
			else:
				even.append(str(i + 1))
		odd = odd[0:len(odd) - 1]
		e = o = 0
		for i in even:
			e += int(i)
		for j in odd:
			o += int(j)
		odd.append(str(e - o))
		a = even + odd
		print(' '.join(a))


import math
t = int(input(''))
while t > 0:
	l = []
	n = int(input(''))
	if n % 4 != 0:
		print('NO')
	else:
		odd_no = 1
		even_no = 2
		for i in range(int(n / 2)):
			l.append(even_no)
			if i % 2 == 1:
				even_no += 4
			else:
				even_no += 2
		for x in range(1, int(n / 2) + 1):
			l.append(odd_no)
			if (x + 1) % 2 == 1:
				odd_no += 2
			else:
				odd_no += 4
		print('YES')
		for ele in l:
			print(ele, end=' ')
		print()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	n = n // 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		a1 = [2 * i for i in range(1, n + 1)]
		a2 = [a1[i] - 1 for i in range(len(a1))]
		a2[-1] += n
		a = a1 + a2
		print(*a)


x = 0
y = 1
ans = 0
ans2 = 0
n = int(input())
arr = list()
for i in range(0, n):
	a = int(input())
	for k in range(0, a // 2):
		x += 2
		arr.append(x)
	for k in range(0, a // 2):
		if k == a // 2 - 1:
			var = sum(arr[0:a // 2]) - sum(arr[a // 2:a - 1])
			if var % 2 == 0:
				var += 1
			arr.append(var)
		else:
			arr.append(y)
			y += 2
	if sum(arr[0:a // 2]) == sum(arr[a // 2:a]):
		print('YES')
		for k in arr:
			print(k, end=' ')
		print('\n')
	else:
		print('NO')
	arr.clear()
	ans2 = 0
	ans = 0
	x = 0
	y = 1


n = int(input())
for i in range(n):
	a = int(input())
	num = a // 2
	if num % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		for i in range(1, num + 1):
			arr.append(2 * i)
		arlen = len(arr)
		for i in range(1, arlen // 2 + 1):
			arr.append(2 * i - 1)
		for i in range(arlen // 2 + 1, arlen + 1):
			arr.append(2 * i + 1)
		print(*arr)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	q = n // 2
	li = []
	if q % 2 == 1:
		ans.append(0)
	else:
		it = 2
		lo = n // 2
		for j in range(lo):
			li.append(it)
			it = it + 2
		it = 1
		for j in range(lo - 1):
			li.append(it)
			it = it + 2
		it = it + n // 2
		li.append(it)
		ans.append(li)
for i in range(t):
	if ans[i] == 0:
		print('NO')
	else:
		print('YES')
		for j in range(len(ans[i])):
			print(ans[i][j], end=' ')
		print()


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [sum(range(2, n + 1, 2)) - sum(range(1, n - 1, 2))]
		print(' '.join(map(str, a)))
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	m = int(input())
	if m % 4 != 0:
		print('\nNO')
	else:
		arr = m * [0]
		j = 0
		a = 0
		o = 1
		b = m // 2
		while j < m:
			if j < b:
				a = a + 2
				arr[j] = a
				j = j + 1
			elif m - j == 1:
				o = o + b
				arr[j] = o
				j = j + 1
			elif j >= b:
				arr[j] = o
				o = o + 2
				j = j + 1
		print('YES')
		for jh in arr:
			print(jh, end=' ')


for _ in range(int(input())):
	n = int(input())
	ans = []
	if n % 4 == 0:
		o_sum = 0
		ans_sum = 0
		print('YES')
		for i in range(int(n / 2)):
			ans.append(2 * (i + 1))
		ans_sum = sum(ans)
		for j in range(int(n / 2) - 1):
			ans.append(2 * (j + 1) - 1)
			o_sum += 2 * (j + 1) - 1
		ans.append(ans_sum - o_sum)
		print(*ans)
	else:
		print('NO')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		array_even = []
		array_odd = []
		sign = -1
		for i in range(3, 3 + n // 2 * 4, 4):
			array_odd.append(i)
			array_even.append(i + sign * 1)
			sign *= -1
		array = array_even + array_odd
		for i in array:
			print(i, end=' ')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		ar = [0] * n
		i = 0
		j = n // 2
		v = 2
		se = 0
		for i in range(0, n // 2):
			ar[i] = v
			se += v
			v += 2
		v = 1
		so = 0
		for i in range(n // 2, n - 1):
			ar[i] = v
			so += v
			v += 2
		ar[-1] = se - so
		print(*ar)


iterations = int(input())
for i in range(iterations):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	temp1 = list(range(2, n + 1, 2))
	temp2 = list(range(1, n - 2, 2))
	temp2.append((3 * n - 2) // 2)
	temp1.extend(temp2)
	print(*temp1)


from sys import stdin

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

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

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ev = list(range(2, n + 1, 2))
		od = list(range(1, n + 1, 2))
		od[-1] += n // 2
		print(*ev, *od)


from collections import defaultdict
from collections import Counter
from string import ascii_lowercase
import math
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)

def solve(n):
	a = [0] * n
	if n // 2 % 2 != 0:
		return ['NO']
	odd = 2
	for i in range(n // 2):
		a[i] = odd
		odd += 2
	even = 1
	st = sum(a)
	s = 0
	for i in range(n // 2, n - 1):
		a[i] = even
		even += 2
		s += a[i]
	a[-1] = st - s
	print('YES')
	return a
t = int(input())
while t:
	n = int(input())
	print(*solve(n))
	t -= 1


def solve():
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		A = [2 * (i + 1) for i in range(n // 2)] + [2 * i + 1 for i in range(n // 2)]
		A[-1] += n // 2
		print(*A)
	return

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


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(1, T + 1):
	n = int(lines[t].strip())
	if n % 4 == 2:
		print('NO')
		continue
	print('YES')
	res = []
	tmp = 0
	for i in range(1, n // 2 + 1):
		res.append(2 * i)
		tmp += 2 * i
	for i in range(1, n // 2):
		res.append(2 * i - 1)
		tmp -= 2 * i - 1
	res.append(tmp)
	print(' '.join(map(str, res)))


for i in range(int(input())):
	n = int(input()) // 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		lis = []
		for i in range(n):
			lis.append(str(2 * i + 2))
		for i in range(n - 1):
			lis.append(str(2 * i + 1))
		lis.append(str(3 * n - 1))
		print(' '.join(lis))


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum1 = 0
		sum2 = 0
		l = []
		for i in range(2, n + 1, 2):
			sum1 = sum1 + i
			l.append(i)
		for j in range(1, n - 2, 2):
			sum2 = sum2 + j
			l.append(j)
		l.append(sum1 - sum2)
		for it in l:
			print(it, end=' ')
		print()


def max_overlap(start, end):
	n = len(start)
	start.sort()
	end.sort()
	inter = 1
	max_inter = 1
	i = 1
	j = 0
	while i < n and j < n:
		if start[i] <= end[j]:
			inter += 1
			if inter > max_inter:
				max_inter = inter
			i += 1
		else:
			inter -= 1
			j += 1
	return max_inter
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	total = 0
	start = []
	end = []
	for i in range(n // 2):
		(small, big) = (a[i], a[n - i - 1])
		if small > big:
			(small, big) = (big, small)
		mini = small + 1
		maxi = big + k
		start.append(mini)
		end.append(maxi + 0.1)
		start.append(big + small)
		end.append(big + small + 0.1)
	overlap = max_overlap(start, end)
	print(n - overlap)


testCases = int(input())

def solve(n):
	even_sum = 0
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(n / 2) + 1, 1):
			even_sum += i * 2
			print(i * 2, end=' ')
		j = 1
		count = 1
		while even_sum and count < int(n / 2):
			print(j, end=' ')
			even_sum -= j
			j += 2
			count += 1
		if even_sum:
			print(even_sum)
while testCases:
	n = int(input())
	solve(n)
	testCases -= 1


def solve():
	T = int(input())
	for t in range(T):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
			continue
		print('YES')
		arr = []
		even_acc = 0
		odd_acc = 0
		for i in range(2, n + 1, 2):
			arr.append(i)
			even_acc += i
		for i in range(1, n + 1, 2):
			arr.append(i)
			odd_acc += i
		while even_acc != odd_acc:
			arr[-1] = arr[-1] + 2
			odd_acc += 2
		for n in arr:
			print(n, end=' ')
solve()


m = 10 ** 9 + 7
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		k = 1
		for i in range(int(n / 2)):
			print(2 * k, end=' ')
			k += 1
		k = 1
		for i in range(int(n / 2) - 1):
			print(k, end=' ')
			k += 2
		print(3 * int(n / 2) - 1)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

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

def stringListIn():
	return [x for x in stdin.readline().split()]

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

def stringIn():
	return stdin.readline().strip()
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		li = []
		st = 2
		s1 = 0
		for i in range(n // 2):
			li.append(st)
			s1 += st
			st += 2
		st = 1
		s2 = 0
		for i in range(n // 2 - 1):
			li.append(st)
			s2 += st
			st += 2
		li.append(s1 - s2)
		print(*li)
	else:
		print('NO')


def findarray(n):
	if n % 4 != 0:
		print('NO')
		return
	newArray = []
	twovalue = 2
	evensum = 0
	onevalue = 1
	oddsum = 0
	for i in range(0, int(n / 2)):
		newArray.append(twovalue)
		evensum += twovalue
		twovalue += 2
	for j in range(0, int(n / 2) - 1):
		newArray.append(onevalue)
		oddsum += onevalue
		onevalue += 2
	newArray.append(evensum - oddsum)
	print('YES')
	newArray = [str(i) for i in newArray]
	a = ' '.join(newArray)
	print(a)
a = int(input())
for i in range(a):
	number = int(input())
	findarray(number)


t = int(input())
for k in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l1 = []
		l2 = []
		for i in range(1, n // 2 + 1):
			l1.append(2 * i)
		for i in range(0, n // 2 - 1):
			l2.append(2 * i + 1)
		l2.append(sum(l1) - sum(l2))
		res = l1 + l2
		print(*res)


t = int(input())
for _ in range(t):
	n = int(input())
	sum1 = 0
	sum2 = 0
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		count = 1
		c = 2
		while count <= n // 2:
			sum1 += c
			print(c, end=' ')
			count += 1
			c += 2
		count = 1
		c = 1
		while count <= n // 2 - 1:
			print(c, end=' ')
			sum2 += c
			count += 1
			c += 2
		print(sum1 - sum2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		list = []
		liest = []
		count = 0
		for d in range(n // 2):
			list.append(d * 4 + 1)
		for c in range(n // 2):
			if c % 2 == 0:
				liest.append(list[c] + 1)
			else:
				liest.append(list[c] - 1)
		s = [str(i) for i in list]
		f = [str(i) for i in liest]
		print(' '.join(f) + ' ' + ' '.join(s))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if (n // 2 * (n // 2 + 1) - (n // 2) ** 2) % 2 == 0:
		print('YES')
		temp = []
		for i in range(1, n // 2 + 1):
			temp.append(2 * i)
		for i in range(1, n // 2 + 1):
			temp.append(2 * i - 1)
		diff = n // 2 * (n // 2 + 1) - (n // 2) ** 2
		if diff != 0:
			temp[n - 1] = temp[n - 1] + diff
			print(' '.join(map(str, temp)))
		else:
			print(' '.join(map(str, temp)))
	else:
		print('NO')


t = int(input())
for _ in range(0, t):
	n = int(input())
	a_even = [2 * int(i) for i in range(1, n // 2 + 1)]
	a_odd = [2 * int(i) + 1 for i in range(0, n // 2 - 1)]
	if len(a_odd) and (sum(a_even) - sum(a_odd)) % 2:
		a_odd.append(sum(a_even) - sum(a_odd))
		print('YES')
		print(*a_even + a_odd)
	else:
		print('NO')


for ii in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		x = 2
		temp1 = []
		temp2 = []
		count = 0
		o = -1
		for i in range(n // 2):
			temp1.append(x)
			temp2.append(x + o)
			x += 2
			count += 1
		temp2[-1] += count
		print(*temp1, *temp2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		sume = 0
		sumo = 0
		print('YES')
		for j in range(n // 2):
			print(2 + 2 * j, end=' ')
			sume += 2 + 2 * j
		c = 1
		for j in range(n // 2, n - 1):
			print(c * 2 - 1, end=' ')
			sumo += c * 2 - 1
			c += 1
		print(sume - sumo)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		b = []
		for i in range(n // 2):
			a.append(2 * (i + 1))
			b.append(2 * (i + 1) - 1)
		c = sum(a)
		d = sum(b) - b[-1]
		b.pop(-1)
		b.append(c - d)
		print(*a + b)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
		continue
	print('YES')
	a = []
	b = []
	for i in range(1, n + 2):
		if i % 2:
			a.append(i)
		else:
			b.append(i)
	a.remove(n / 2 + 1)
	for i in b:
		print(i, end=' ')
	for i in a:
		print(i, end=' ')
	print()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n / 2 % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
		arr1 = []
		even = 2
		for i in range(int(n / 2)):
			arr1.append(even)
			if i % 2 == 0:
				even += 2
			else:
				even += 4
		arr2 = []
		odd = 1
		for j in range(int(n / 2)):
			arr2.append(odd)
			if j % 2 == 0:
				odd += 4
			else:
				odd += 2
		for k in range(len(arr1)):
			print(arr1[k], end=' ')
		for l in range(len(arr2)):
			if l == len(arr2) - 1:
				print(arr2[l])
			else:
				print(arr2[l], end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
		continue
	a = [0] * n
	n //= 2
	d = 2
	for j in range(n):
		a[j] = d
		a[j + n] = d - 1
		if j % 2 == 1:
			a[j + n] += 2
		d += 4
	print('YES')
	for j in a:
		print(j, end=' ')
	print()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		odds = [2 * i + 1 for i in range(n // 2)]
		sumo = sum(odds)
		pair = [2 * (i + 1) for i in range(n // 2)]
		sump = sum(pair)
		diff = sumo - sump
		if diff < 0:
			odds[-1] += -diff
		elif diff > 0:
			pair[-1] += diff
		totl = pair + odds
		print(' '.join([str(x) for x in totl]))


from sys import stdin, stdout

class Solve:

	def __init__(self):
		r = stdin.readline
		w = stdout.write
		ans = []
		for _ in range(int(input())):
			n = int(r())
			if n % 4 == 0:
				ans.append('YES\n')
				(even, total_even) = (2, 0)
				for i in range(n // 2):
					ans.append(str(even) + ' ')
					total_even += even
					even += 2
				(odd, total_odd) = (-1, 0)
				for i in range(n // 2 - 1):
					odd += 2
					total_odd += odd
					ans.append(str(odd) + ' ')
				ans.append(str(total_even - total_odd) + '\n')
			else:
				ans.append('NO\n')
		w(''.join(ans))

def main():
	s = Solve()
main()


import math as m
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print('NO')
	else:
		p = n // 2
		if p % 2 == 0:
			print('YES')
			for i in range(1, p + 1):
				print(2 * i, end=' ')
			for i in range(p + 1):
				a = 2 * i + 1
				if i != p // 2:
					print(a, end=' ')
			print()
		else:
			print('NO')


def balancedArray(n):
	if n % 4 != 0:
		return []
	even = [2 * i for i in range(1, n // 2 + 1)]
	odd = [i for i in range(1, n - 1, 2)]
	odd.append(sum(even) - sum(odd))
	return even + odd
for _ in range(int(input())):
	n = int(input())
	result = balancedArray(n)
	if len(result) > 0:
		print('YES')
		print(*result)
	else:
		print('NO')


def solve():
	data = int(input())
	num = data // 2
	if num % 2 == 1:
		print('NO')
	else:
		ans = [i for i in range(2, 2 * num + 1, 2)]
		avg = sum(ans) // num
		ans2 = [i for i in range(1, 2 * (num // 2), 2)]
		ans3 = [i for i in range(avg + 2, avg * 2 + 1, 2)]
		print('YES')
		print(' '.join([str(x) for x in ans + ans2 + ans3]))
nums = int(input())
for _ in range(1, nums + 1):
	solve()


for _ in range(int(input())):
	n = int(input())
	n = n // 2
	if n % 2 != 0:
		print('NO')
	else:
		print('YES')
		b = []
		c = []
		s = 0
		j = 3
		for i in range(n):
			s += j
			b.append(j)
			j += 2
		j = 2
		for i in range(n - 1):
			s -= j
			c.append(j)
			j += 2
		c.append(s)
		c += b
		print(*c)


for _ in range(int(input())):
	n = int(input())
	l = [0] * n
	i = 0
	j = n // 2
	fg = 0
	if n % 4 == 0:
		print('YES')
		k = 1
		for m in range(1, n // 4 + 1):
			l[i] = k + 1
			l[i + 1] = k + 3
			l[j] = k
			l[j + 1] = k + 4
			i += 2
			j += 2
			k += 6
		print(*l)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		out = [0] * n
		(evst, evend) = (0, n // 2 - 1)
		(oddst, oddend) = (n // 2, n - 1)
		(curEv, ev) = (2, n)
		(curOd, od) = (1, n + 1)
		for i in range(n // 4):
			(out[evst], out[evend]) = (curEv, ev)
			(out[oddst], out[oddend]) = (curOd, od)
			evst += 1
			evend -= 1
			oddst += 1
			oddend -= 1
			curEv += 2
			ev -= 2
			curOd += 2
			od -= 2
		print(' '.join(map(str, out)))


x = 10 ** 5
for i in range(int(input())):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		l1 = []
		l2 = []
		for i in range(2, a + 2):
			if i % 2 == 0:
				print(i, end=' ')
		for i in range(1, a - 1):
			if i % 2 == 1:
				print(i, end=' ')
		print(int(i + 1 + a / 2))


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		for e in range(1, n // 2 + 1):
			print(e * 2, end=' ')
		for o in range(1, n - 1, 2):
			print(o, end=' ')
		val = n + n // 2 - 1
		print(val)
	else:
		print('NO')
	t -= 1


import sys
from math import log2, floor, ceil, sqrt
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(n, k) = Ri()
	a = Ri()
	dp = [0] * (2 * k + 2)
	dic = {}
	for i in range(n // 2):
		if a[i] + a[n - i - 1] in dic:
			dic[a[i] + a[n - i - 1]] += 1
		else:
			dic[a[i] + a[n - 1 - i]] = 1
	for i in range(n // 2):
		dp[k + max(a[i], a[n - 1 - i]) + 1] -= 1
		dp[1 + min(a[i], a[n - 1 - i])] += 1
	for i in range(1, 2 * k + 2):
		dp[i] = dp[i - 1] + dp[i]
	minn = INF
	for i in range(2, 2 * k + 1):
		no = 0
		if i in dic:
			no = dic[i]
		cost = dp[i] - no
		cost += 2 * (n // 2 - dp[i])
		if n % 2 == 1:
			if a[n // 2] != i:
				cost += 1
		minn = min(minn, cost)
	print(minn)


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		if N // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			A = [2 * i for i in range(1, N // 2 + 1)]
			B = [a - 1 for a in A[:-1]]
			B.append(sum(A) - sum(B))
			print(*A, *B)
main()


for _ in range(int(input())):
	n = int(input())
	n1 = n
	flag = 0
	if n % 4 != 0:
		print('NO')
		flag = 1
	if flag == 0:
		print('YES')
		a = [int(x) for x in range(2, n + 1, 2)]
		b = [int(y) for y in range(1, n + 1, 2)]
		b[-1] = b[-1] + n // 2
		final = a + b
		print(*final)


import sys
input = sys.stdin.readline
from math import *
import bisect as bs
t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	d = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		c = min(a[i], a[n - i - 1])
		dd = max(a[i], a[n - i - 1])
		maxi = a[i] + a[n - i - 1] + k - c
		mini = a[i] + a[n - i - 1] - dd + 1
		d[mini] += 1
		d[a[i] + a[n - i - 1]] -= 1
		d[a[i] + a[n - i - 1] + 1] += 1
		d[maxi + 1] -= 1
		if mini > 2:
			d[2] += 2
			d[mini] -= 2
		if maxi < 2 * k:
			d[maxi + 1] += 2
			d[2 * k + 1] -= 2
	for i in range(1, len(d)):
		d[i] += d[i - 1]
	print(min(d[2:2 * k + 1]))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
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 [int(x) for x in sys.stdin.readline().split()]

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

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

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

def S():
	return input()

def main():
	n = I()
	ans_a = []
	ans_b = []
	for _ in range(n):
		x = I()
		if x % 4 != 0:
			ans_a.append(0)
			ans_b.append([])
			continue
		ans_a.append(1)
		_ans_a = []
		_ans_b = []
		for i in range(1, x // 2 + 1):
			_ans_a.append(i * 2)
			_ans_b.append(i * 2 - 1)
		_ans_b[-1] += x // 2
		ans_b.append(_ans_a + _ans_b)
	for i in range(n):
		x = ans_a[i]
		if x == 0:
			print('NO')
			continue
		print('YES')
		print(' '.join((str(x) for x in ans_b[i])))
main()


def a(n):
	a = list()
	b = list()
	for i in range(1, n + 1):
		if i % 2 == 0:
			a.append(i)
		else:
			b.append(i)
	if not sum(a) == sum(b):
		b[-1] = sum(a) - sum(b[:-1])
	return a + b

def check(n):
	if n == 2 or n // 2 % 2 != 0:
		return False
	else:
		return True
t = int(input())
for i in range(t):
	n = int(input())
	if check(n):
		print('YES')
		print(*a(n))
	else:
		print('NO')


def arrary(n):
	l = n // 2
	arr = []
	if n <= 2:
		print('NO')
	elif l % 2 == 1:
		print('NO')
	else:
		print('YES')
		evensm = 0
		for i in range(1, l + 1):
			print(2 * i, end=' ')
			evensm = evensm + 2 * i
		oddsm = 0
		for j in range(0, l - 1):
			print(2 * j + 1, end=' ')
			oddsm += 2 * j + 1
		print(evensm - oddsm)
t = int(input())
for _ in range(t):
	n = int(input())
	arrary(n)


T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		n = n // 2
		nums = [2 * i for i in range(1, n + 1)]
		nums[len(nums) - 1] += n
		for i in range(1, n + 1):
			nums.append(2 * i + 1)
		for num in nums:
			print(num, end=' ')
		print()


import math
g = lambda x: map(x, input().split())

def main():
	n = int(input())
	while n:
		n -= 1
		a = int(input())
		v = [None] * a
		k = a // 2
		x = 2
		i = 0
		(c1, c2) = (0, 0)
		while i < a / 2:
			v[i] = x
			c1 += v[i]
			v[k] = x - 1
			c2 += v[k]
			i += 1
			if not i < a / 2:
				break
			k += 1
			x += 2
			v[i] = x
			c1 += v[i]
			v[k] = x + 1
			c2 += v[k]
			i += 1
			k += 1
			x += 4
		if not c1 == c2:
			print('NO')
		else:
			print('YES')
			for i in v:
				print(i, end=' ')
			print()
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	freq = [0 for i in range(2 * k + 5)]
	freq2 = [0 for i in range(2 * k + 5)]

	def check(ans1):
		ans = float('inf')
		best = 0
		for i in range(1, 2 * k + 5):
			tmp = 0
			for j in range(n // 2):
				if a[j] + a[n - j - 1] != i:
					if i - a[j] >= 1 and i - a[j] <= k:
						tmp += 1
					elif i - a[n - j - 1] >= 1 and i - a[n - j - 1] <= k:
						tmp += 1
					else:
						tmp += 2
			if tmp < ans:
				best = i
			ans = min(ans, tmp)
		return ans
	for i in range(n // 2):
		freq[min(a[n - 1 - i], a[i]) + 1] -= 1
		freq[0] += 1
		freq[max(a[n - 1 - i], a[i]) + k + 1] += 1
	for i in range(n // 2):
		freq2[a[i] + a[n - i - 1]] += 1
	ans = float('inf')
	for i in range(1, 2 * k + 1):
		freq[i] += freq[i - 1]
		ans = min(ans, freq[i] + n // 2 - freq2[i])
	print(ans)


from collections import defaultdict, deque
import heapq, bisect, math, itertools, string, queue, copy, time
import sys
input = sys.stdin.readline
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

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

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

def inpl_str():
	return list(input().split())
t = inp()
for _ in range(t):
	n = inp()
	if n % 4 == 0:
		print('YES')
	else:
		print('NO')
		continue
	first = range(2, n + 1, 2)
	second = range(1, n - 1, 2)
	for i in first:
		print('{}'.format(i), end=' ')
	for i in second:
		print('{}'.format(i), end=' ')
	print(sum(first) - sum(second))


import collections
t = int(input())
for ii in range(t):
	n = int(input())
	n = n // 2
	if n % 2 != 0:
		print('NO')
	else:
		a = []
		for i in range(1, n + 1):
			a.append(2 * i)
		for i in range(n // 2):
			a.append(a[i] - 1)
		for i in range(n // 2, n):
			a.append(a[i] + 1)
		print('YES')
		a = [str(i) for i in a]
		print(' '.join(a))


j = int(input())
for j0 in range(j):
	n = int(input())
	ans = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = 0
		for i in range(0, int(n / 2)):
			t = 2 * (i + 1)
			ans.append(t)
		for q in range(int(n / 2), int(n / 2 + n / 4)):
			r = ans[e] - 1
			e += 1
			ans.append(r)
		for y in range(int(n / 2 + n / 4), n):
			u = ans[e] + 1
			e += 1
			ans.append(u)
		ans1 = [str(o) for o in ans]
		ans2 = ' '.join(ans1)
		print(ans2)


import sys
input = sys.stdin.readline
import math
power = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
t = int(input())
for ijk in range(t):
	(n, k) = map(int, input().split())
	arr = [int(i) for i in input().split()]
	(a1, a2) = ([0] * (2 * k + 2), [0] * (2 * k + 2))
	for i in range(len(arr) // 2):
		xy = min(arr[i], arr[-i - 1])
		yx = max(arr[i], arr[-i - 1])
		a1[xy] += 1
		if xy != arr[i] + arr[-i - 1] - 1:
			a1[arr[i] + arr[-i - 1] - 1] += 1
		a2[yx + k + 1] += 1
		if yx != arr[i] + arr[-i - 1] + 1:
			a2[arr[i] + arr[-i - 1] + 1] += 1
	(pref, suff) = ([0], [0])
	pref[0] = a1[-1]
	suff[0] = a2[0]
	for i in range(1, len(a1)):
		pref.append(a1[-i - 1] + pref[-1])
		suff.append(a2[i] + suff[-1])
	pref.reverse()
	mina = math.inf
	for i in range(1, 2 * k + 1):
		mina = min(mina, pref[i] + suff[i])
	sys.stdout.write(str(mina) + '\n')


t = int(input())
for x in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l1 = list(range(1, n + 1))
		l2 = []
		l3 = []
		l2.extend(l1[1:n:2])
		l3.extend(l1[0:n - 3:2])
		l3.append(n + n // 2 - 1)
		l2.extend(l3)
		print('YES')
		print(*l2, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		h = n // 4
		even = []
		x = 2
		for _ in range(h):
			even.append(x)
			even.append(x + 2)
			x += 2 + 4
		odd = []
		x = 1
		for _ in range(h):
			odd.append(x)
			odd.append(x + 4)
			x += 4 + 2
		for x in even:
			print(x, end=' ')
		for x in odd:
			print(x, end=' ')
		print()


def main1():
	T = int(input())
	results = []
	for case in range(1, T + 1):
		(n, k) = [int(i) for i in input().split()]
		a = [int(i) for i in input().split()]
		sums = set()
		sums_dict = {}
		best_changes = 1000000000.0
		su = k + 1
		changes = 0
		for i in range(n // 2):
			a1 = a[i]
			a2 = a[~i]
			add = a1 + a2
			if add != su:
				changes += 1
			sums.add(add)
			if add not in sums_dict.keys():
				sums_dict[add] = 0
			sums_dict[add] += 1
		best_changes = min(best_changes, changes)
		for su in sums:
			changes = 0
			if n // 2 - sums_dict[su] > best_changes:
				continue
			for i in range(n // 2):
				a1 = a[i]
				a2 = a[~i]
				add = a1 + a2
				if add != su:
					changes += 1
					if add > su:
						changes += int(max(a1, a2) - (add - su) < 1)
					elif add < su:
						changes += int(min(a1, a2) + (su - add) > k)
				if changes >= best_changes:
					break
			best_changes = min(best_changes, changes)
		results.append(best_changes)
	for result in results:
		print(result)

def main2():
	T = int(input())
	results = []
	for case in range(1, T + 1):
		(n, k) = [int(i) for i in input().split()]
		a = [int(i) for i in input().split()]
		dp = [0 for i in range(2 * k + 1 + 1)]
		dp[0] = n
		for i in range(n // 2):
			a1 = a[i]
			a2 = a[~i]
			add = a1 + a2
			small = min(a1, a2)
			big = max(a1, a2)
			upper_bound = add + (k - small)
			lower_bound = add - (big - 1)
			dp[lower_bound] -= 1
			dp[add] -= 1
			dp[add + 1] += 1
			dp[upper_bound + 1] += 1
		changes = []
		csum = 0
		for su in dp:
			csum += su
			changes.append(csum)
		results.append(min(changes))
	for result in results:
		print(result)
main2()


from sys import stdin, stdout
for tc in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(2, n + 1, 2):
			a.append(i)
		for i in range(1, n, 2):
			a.append(i)
		a[-1] += n // 2
		print(*a)


import sys
input = sys.stdin.buffer.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		re = n // 2
		l = list(range(2, n + 1, 2))
		l += list(range(1, n - 2, 2))
		lasn = 3 * re - 1
		l.append(lasn)
		print('yes')
		print(*l)


def update(bit, l, r, n, val):
	updatebit(bit, n, l, val)
	updatebit(bit, n, r + 1, -val)

def updatebit(bit, n, i, val):
	i += 1
	while i <= n:
		bit[i] += val
		i += i & -i

def get(bit, i):
	res = 0
	i += 1
	while i > 0:
		res += bit[i]
		i -= i & -i
	return res
t = int(input())
for tt in range(t):
	(N, K) = (int(i) for i in input().split())
	A = [int(i) for i in input().split()]
	pos = [0] * (2 * K + 2)
	n = len(pos) - 1
	for i in range(N // 2):
		(cur, mir) = (A[i], A[N - i - 1])
		L = R = cur + mir
		update(pos, L, R, n, -1)
		(L, R) = (min(cur, mir) + 1, max(cur, mir) + K)
		update(pos, L, R, n, -1)
	ans = N + min((get(pos, i) for i in range(2, n)))
	print(ans)


from collections import defaultdict
import sys
stream = sys.stdin
t = int(stream.readline())
for line in stream:
	(n, k) = line.split()
	(n, k) = map(int, (n, k))
	sums_rating = defaultdict(int)
	open_close = defaultdict(int)
	numbers = stream.readline().split()
	for i in range(n // 2):
		n1 = int(numbers[i])
		n2 = int(numbers[-(i + 1)])
		sums_rating[n1 + n2] += 1
		mini = min(n1, n2)
		maxi = max(n1, n2)
		open_close[mini + 1] += 1
		open_close[maxi + k + 1] -= 1
	curr_modifier = 0
	best_result = -float('inf')
	for i in range(2, 2 * k + 1):
		curr_modifier += open_close[i]
		if sums_rating[i] + curr_modifier > best_result:
			best_result = sums_rating[i] + curr_modifier
	print(n - best_result)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, ' ')
		for j in range(1, n // 2):
			print(j * 2 - 1, ' ')
		print(3 * n // 2 - 1)


def evensum(n):
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = n // 2
		x = 2
		a = []
		for i in range(l):
			a.append(x)
			print(x, end=' ')
			x += 2
		res = sum(a)
		a = []
		x = 1
		for i in range(l - 1):
			a.append(x)
			print(x, end=' ')
			x = x + 2
		print(res - sum(a))
t = int(input())
for i in range(t):
	n = int(input())
	evensum(n)


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


n = int(input())
tests = [int(input()) for _ in range(n)]
answers = []
for test in tests:
	test = test // 2
	if test % 2 != 0:
		answers.append('NO')
	else:
		temp1 = [2]
		temp2 = [1]
		for _ in range(test - 1):
			temp1.append(temp1[-1] + 2)
		stemp1 = sum(temp1)
		for _ in range(test - 2):
			temp2.append(temp2[-1] + 2)
		stemp2 = sum(temp2)
		temp2.append(stemp1 - stemp2)
		answers.append('YES')
		answers.append(temp1 + temp2)
for _ in answers:
	if type(_) == list:
		[print(i, end=' ') for i in _]
		print('')
	else:
		print(_)


from collections import defaultdict
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l1 = list(map(int, input().split()))
	sum_array = []
	couple_array = []
	for j in range(len(l1) // 2):
		sum_array.append(l1[j] + l1[-j - 1])
		couple_array.append((l1[j], l1[-j - 1]))
	d = defaultdict(int)
	for ii in sum_array:
		d[ii] += 1
	range_array = []
	for ii in couple_array:
		range_array.append([min(ii) + 1, max(ii) + k])
	pref_array = [0] * (2 * k + 2)
	for ii in range_array:
		pref_array[ii[0]] = pref_array[ii[0]] + 1
		pref_array[ii[1] + 1] = pref_array[ii[1] + 1] - 1
	for ii in range(1, len(pref_array)):
		pref_array[ii] = pref_array[ii] + pref_array[ii - 1]
	count_array = []
	for ii in range(2, 2 * k + 1):
		if d.get(ii):
			a0 = d.get(ii)
		else:
			a0 = 0
		a1 = pref_array[ii] - a0
		a2 = n // 2 - a1 - a0
		count = 2 * a2 + a1
		count_array.append(count)
	print(min(count_array))


t = int(input())
from collections import deque
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ans = deque()
		s = 0
		t = 0
		for i in range(n // 2):
			if i != n // 2 - 1:
				s += 2 * (i + 1)
				t += 2 * (i + 1) - 1
				ans.appendleft(2 * (i + 1))
				ans.append(2 * (i + 1) - 1)
			else:
				s += 2 * (i + 1)
				ans.appendleft(2 * (i + 1))
				ans.append(s - t)
		print('YES')
		print(*ans)


def solve():
	(n, k) = [int(i) for i in input().split()]
	v = [int(i) for i in input().split()]
	sum = [0] * (2 * k + 2)
	for i in range(n // 2):
		x = v[i]
		y = v[n - i - 1]
		if y > x:
			(x, y) = (y, x)
		sum[x + y] += 1
		sum[x + k + 1] -= 1
		sum[y + 1] += 1
		sum[x + y + 1] -= 1
	pos = -1
	mx = -9999999
	for i in range(len(sum)):
		sum[i] += sum[i - 1]
		if sum[i] > mx:
			mx = sum[i]
			pos = i
	elem = pos
	c = 0
	for i in range(n // 2):
		x = v[i]
		y = v[n - i - 1]
		if y > x:
			(x, y) = (y, x)
		if elem >= y + 1 and elem <= x + k:
			if x + y != elem:
				c += 1
		else:
			c += 2
	print(c)
t = int(input())
while t:
	t -= 1
	solve()


for i in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO')
		continue
	ev = []
	od = []
	suev = 0
	suod = 0
	for j in range(1, n + 1):
		if j % 2 == 0:
			ev.append(j)
			suev += j
		else:
			od.append(j)
			suod += j
	if suev > suod:
		suod -= od[-1]
		a = od[-1]
		del od[-1]
		ans = suev - suod
		if ans not in od and ans % 2 == 1:
			od.append(ans)
			suod += ans
	if suev == suod:
		print('YES')
		for nn in ev:
			print(nn, end=' ')
		for nn in od:
			print(nn, end=' ')
		print()
	else:
		print('NO')


INT_MAX = 10 ** 18 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
GETA = 123
for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print(2 * (i + 1), end=' ')
		for j in range(n // 2 - 1):
			print(2 * j + 1, end=' ')
		print(2 * (j + 1) + 1 + n // 2)


from __future__ import division, print_function

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = list(map(int, input().split()))
		cost = [0] * (2 * k + 2)
		count = [0] * (2 * k + 2)
		for i in range(n // 2):
			cost[min(l[i] + 1, l[n - i - 1] + 1)] += 1
			cost[max(l[i] + k, l[n - i - 1] + k) + 1] -= 1
			if min(l[i] + 1, l[n - i - 1] + 1) - 1 >= 2:
				cost[2] += 2
				cost[min(l[i] + 1, l[n - i - 1] + 1)] -= 2
			if max(l[i] + k, l[n - i - 1] + k) + 1 <= 2 * k:
				cost[max(l[i] + k, l[n - i - 1] + k) + 1] += 2
				cost[2 * k + 1] -= 2
			cost[l[i] + l[n - i - 1]] -= 1
			cost[l[i] + l[n - i - 1] + 1] += 1
		for i in range(2, 2 * k + 1):
			cost[i] = cost[i] + cost[i - 1]
		ans = cost[2 * k]
		for i in range(2, 2 * k + 1):
			ans = min(ans, cost[i])
		cout << ans << '\n'
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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 sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


n = int(input())
for i in range(n):
	x = int(input())
	if x % 4 != 0:
		print('NO')
	else:
		l = list()
		r = list()
		for j in range(1, x + 1):
			if j % 2 == 0:
				l.append(j)
			else:
				r.append(j)
		lsum = sum(l)
		rsum = sum(r)
		r[len(r) - 1] += abs(lsum - rsum)
		print('YES')
		l += r
		for c in l:
			print(c, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		k = n // 4
		s1 = []
		s2 = []
		(a, b) = (2, 4)
		for i in range(k):
			s1.append(a)
			s1.append(b)
			a += 6
			b += 6
		a = 1
		b = 5
		for i in range(k):
			s2.append(a)
			s2.append(b)
			a += 6
			b += 6
		print('YES')
		print(*s1, end=' ')
		print(*s2)


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	n0_cnt = [0] * (2 * k + 1)
	for i in range(n // 2):
		n0_cnt[A[i] + A[n - i - 1]] += 1
	n1_cnt = [0] * (2 * k + 2)
	for i in range(n // 2):
		minv = min(A[i], A[n - i - 1]) + 1
		maxv = max(A[i], A[n - i - 1]) + k
		n1_cnt[minv] += 1
		n1_cnt[maxv + 1] -= 1
	for i in range(2, 2 * k + 2):
		n1_cnt[i] += n1_cnt[i - 1]
	ans = 4 * 10 ** 5
	for i in range(2, 2 * k + 1):
		chg0 = n0_cnt[i]
		chg1 = n1_cnt[i] - n0_cnt[i]
		chg2 = n // 2 - chg0 - chg1
		ans = min(ans, 0 * chg0 + chg1 + 2 * chg2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	else:
		m = n // 2
		l = []
		x = 2
		for i in range(n // 2):
			l.append(x)
			x += 2
		j = 0
		for i in range(n // 4):
			l.append(l[j] - 1)
			j += 1
		for i in range(n // 4):
			l.append(l[j] + 1)
			j += 1
		print('YES')
		print(*l)


x = int(input())
for _ in range(x):
	y = int(input())
	arr = [0] * y
	add = 2
	if y < 4 or y // 2 % 2 != 0:
		print('NO')
	else:
		add = 2
		for i in range(0, y // 2):
			arr[i] = add
			add += 2
		add = 3
		for i in range(y // 2, y):
			arr[i] = add
			add += 2
		arr[len(arr) // 2 - 1] += len(arr) // 2
		arr = [str(char) for char in arr]
		print('YES')
		print(' '.join(arr))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l1 = [i for i in range(2, n + 1) if i % 2 == 0]
		l2 = [i for i in range(1, n) if i % 2 != 0]
		l2[-1] += n // 2
		l1 += l2
		print(' '.join(map(str, l1)))


t = int(input())
for i in range(t):
	n = int(input())
	c = 2
	d = 1
	la = []
	lb = []
	res = []
	s1 = 0
	s2 = 0
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			la.append(c)
			s1 = s1 + c
			c = c + 2
		for i in range(n // 2 - 1):
			lb.append(d)
			s2 = s2 + d
			d = d + 2
		val = s1 - s2
		lb.append(val)
		res = la + lb
		print(*res)


t = int(input())
l = []
for e in range(t):
	l.append(int(input()))
for e in l:
	if e % 4 != 0:
		print('NO')
	else:
		sol = []
		print('YES')
		for i in range(2, e + 1, 2):
			sol.append(str(i))
		for i in range(1, e, 2):
			sol.append(str(i))
		sol[-1] = str(int(int(sol[-1]) + e / 2))
		print(' '.join(sol))


for _ in range(int(input())):
	n = int(input())
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		e = []
		o = []
		for i in range(1, k + 1):
			e.append(i * 2)
		ladd = 0
		for i in range(len(e)):
			if i == len(e) - 1:
				o.append(e[i] + ladd)
			else:
				o.append(e[i] - 1)
				ladd += 1
		e = e + o
		for i in range(n):
			print(e[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = [0 for i in range(n)]
		s = 0
		se = 0
		for i in range(n // 2):
			s += 2
			a[i] = s
			se += a[i]
			print(a[i], end=' ')
		s = -1
		so = 0
		for i in range(n // 2 - 1):
			s += 2
			a[i + n // 2] = s
			so += a[i + n // 2]
			print(a[i + n // 2], end=' ')
		a[n - 1] = abs(se - so)
		print(a[n - 1], end=' ')
		print('')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('No')
	else:
		print('Yes')
		for j in range(2, n + 1, 2):
			print(j, end=' ')
		for j in range(1, n - 1, 2):
			print(j, end=' ')
		print(n + (n - 1) // 2)


t = int(input())
a = []
(kol1, kol2) = (2, 1)
(sm1, sm2) = (0, 0)
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(n // 2):
			sm1 += kol1
			a.append(kol1)
			kol1 += 2
		for j in range(n // 2 - 1):
			sm2 += kol2
			a.append(kol2)
			kol2 += 2
		a.append(sm1 - sm2)
		print(*a)
		(kol1, kol2) = (2, 1)
		(sm1, sm2) = (0, 0)
		a.clear()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		s = 0
		p = 0
		for i in range(1, n // 2 + 1):
			l.append(2 * i)
			s += 2 * i
		for j in range(1, n // 2):
			l.append(2 * j - 1)
			p += 2 * j - 1
		l.append(s - p)
		for i in l:
			print(i, end=' ')
		print()


testCase = int(input())
for i in range(testCase):
	even = []
	odd = []
	e = 2
	list_size = int(input())
	half_list_size = list_size // 2
	if half_list_size % 2 != 0 or list_size == 0:
		print('NO')
	else:
		print('YES')
		for j in range(half_list_size):
			even.append(e)
			e = e + 2
		o = sum(even)
		for j in range(half_list_size - 1):
			o = o - (2 * j + 1)
			odd.append(2 * j + 1)
		odd.append(o)
		res = even + odd
		for x in range(len(res)):
			print(res[x], end=' ')


from sys import stdin, stdout
read = stdin.readline
write = stdout.write
for _ in range(int(read())):
	n = int(read())
	if n / 2 % 2 == 1:
		write('NO' + '\n')
	else:
		write('YES' + '\n')
		for i in range(2, n + 1, 2):
			write(str(i) + ' ')
		for i in range(1, n - 2, 2):
			write(str(i) + ' ')
		write(str(n + n // 2 - 1) + '\n')


import sys, bisect
from math import gcd
input = sys.stdin.readline

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

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

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
times = 60
t = inp()
for _ in range(t):
	n = inp()
	has = True
	if n == 2:
		print('NO')
	elif n // 2 % 2 != 0:
		print('NO')
	else:
		ans = [0 for i in range(n)]
		leng = n // 2
		i = 2
		index = 0
		while index < leng:
			ans[index] = i
			i += 2
			index += 1
		i = 1
		while index < n - 1:
			ans[index] = i
			i += 2
			index += 1
		ans[n - 1] = i + leng
		print('YES')
		print(*ans)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
t = nextInt()
for _ in range(t):
	n = nextInt()
	k = nextInt()
	arr = [nextInt() for i in range(n)]
	changes = [0] * (2 * k + 10)
	for i in range(n // 2):
		a = arr[i]
		b = arr[n - i - 1]
		st = min(a, b) + 1
		end = max(a, b) + k
		if st > 2:
			changes[2] += 2
			changes[st] -= 1
		else:
			changes[2] += 1
		if end + 1 < len(changes):
			changes[end + 1] += 1
		changes[a + b] -= 1
		changes[a + b + 1] += 1
	for i in range(3, len(changes)):
		changes[i] += changes[i - 1]
	print(min(changes[2:]))


inf = float('inf')
T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	B = [0] * (2 * K + 1)
	C = [0] * (2 * K + 2)
	for i in range(N // 2):
		(a, b) = (A[i], A[N - i - 1])
		if a > b:
			(a, b) = (b, a)
		B[a + b] += 1
		C[a + 1] += 1
		C[K + b + 1] -= 1
	ans = inf
	M = 0
	for k in range(1, 2 * K + 1):
		C[k] += C[k - 1]
		(b, c) = (B[k], C[k])
		a = c - b + 2 * (N // 2 - c)
		ans = min(ans, a)
	print(ans)


def balanced_array(n):
	even = [x for x in range(2, n + 2, 2)]
	odd = [x for x in range(1, n - 2, 2)]
	last_odd = sum(even) - sum(odd)
	if last_odd % 2 != 0:
		odd.append(last_odd)
		print('YES')
		print(*even + odd)
	else:
		print('NO')
n = input()
for i in range(int(n)):
	a = input()
	balanced_array(int(a))


def run(lst, n, k):
	pref = [0 for i in range(2 * k + 2)]
	for i in range(int(n / 2)):
		l = lst[i]
		r = lst[n - i - 1]
		menor = min(l, r)
		maior = max(l, r)
		pref[1] += 2
		pref[menor + 1] -= 1
		pref[l + r] -= 1
		pref[l + r + 1] += 1
		pref[maior + k + 1] += 1
	for i in range(1, len(pref)):
		pref[i] += pref[i - 1]
	print(min(pref[2:-1]))
i = int(input())
for _ in range(i):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	run(lst, n, k)


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
mi = min
ma = max
l = len
t = iinp()
for _ in range(t):
	(lon, valormax) = ent()
	numeros = lient()
	s = [0] * (2 * valormax + 2)
	for i in range(lon // 2):
		puntero1 = numeros[i]
		puntero2 = numeros[lon - i - 1]
		s[2] += 2
		s[mi(puntero1, puntero2) + 1] -= 1
		s[ma(puntero1, puntero2) + valormax + 1] += 1
		s[puntero1 + puntero2] -= 1
		s[puntero1 + puntero2 + 1] += 1
	for i in range(2, 2 * valormax + 2):
		s[i] += s[i - 1]
	print(mi(s[2:]))


import sys
from itertools import accumulate

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(N, K) = MAP()
	A = LIST()
	B = [()] * (N // 2)
	for i in range(N // 2):
		j = N - i - 1
		if A[i] < A[j]:
			B[i] = (A[i], A[j])
		else:
			B[i] = (A[j], A[i])
	imos = [0] * (K * 2 + 2)
	imos[1] = N
	imos[-1] = -N
	for (a, b) in B:
		sm = a + b
		imos[sm] -= 1
		imos[sm + 1] += 1
		lo = a + 1
		hi = K + b
		imos[lo] -= 1
		imos[hi + 1] += 1
	imos = list(accumulate(imos))
	ans = min(imos[1:-1])
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	dp = [0] * (2 * k + 2)
	i = 0
	j = n - 1
	while i < j:
		(x, y) = (min(a[i], a[j]), max(a[i], a[j]))
		dp[0] += 2
		dp[x + 1] -= 1
		dp[x + y] -= 1
		dp[x + y + 1] += 1
		dp[y + k + 1] += 1
		i += 1
		j -= 1
	for i in range(1, len(dp)):
		dp[i] += dp[i - 1]
	print(min(dp))


def oddIntegers(n, k, l):
	if n % 2 != k % 2:
		return -1
	sum = 0
	i = 1
	j = 1
	while j < k:
		sum += i
		l.append(i)
		i += 2
		j += 1
	fin = int(n - sum)
	l.append(fin)
t = int(input())
for _ in range(t):
	n = int(input())
	n1 = n / 2
	su = n1 * (n1 + 1)
	k = []
	for i in range(2, n + 1, 2):
		k.append(i)
	l = []
	if oddIntegers(su, n1, l) != -1:
		k += l
		print('YES')
		for i in k:
			print(i, end=' ')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
		continue
	print('YES')
	n //= 2
	A = []
	B = []
	for i in range(n):
		A.append(i * 2 + 2)
		A.append(10 ** 9 - i * 2)
		B.append(i * 2 + 3)
		B.append(10 ** 9 - 1 - i * 2)
	print(*A + B)


import math
t = int(input())
for z in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	k = 0
	for i in range(int(n / 2)):
		k += 2
		print(k, end=' ')
	k = -1
	for i in range(int(n / 2) - 1):
		k += 2
		print(k, end=' ')
	print(k + 2 + int(n / 2))


N = int(input())
for i in range(N):
	(n, k) = list(map(int, input().strip().split(' ')))
	a = list(map(int, input().strip().split(' ')))
	pairs = []
	prefixSum = [0] * (2 * k + 2)
	ht = {}
	for i in range(n // 2):
		mi = min(a[i], a[n - i - 1])
		ma = max(a[i], a[n - i - 1])
		l = mi + 1
		r = ma + k
		if mi + ma not in ht:
			ht[mi + ma] = 1
		else:
			ht[mi + ma] += 1
		prefixSum[l] += 1
		prefixSum[r + 1] -= 1
	sum = 0
	for i in range(len(prefixSum)):
		sum += prefixSum[i]
		prefixSum[i] = sum
	minCnt = n
	for i in range(2, 2 * k + 1):
		zero = ht.setdefault(i, 0)
		ones = prefixSum[i] - zero
		twos = n // 2 - ones - zero
		count = twos * 2 + ones
		minCnt = min(count, minCnt)
	print(minCnt)


test = int(input())
for i in range(test):
	n = int(input())
	j = 1
	k = 1
	s = n // 2 * (n // 2 + 1)
	while k < n // 2:
		s -= j
		j += 2
		k += 1
	if s % 2 == 0:
		print('NO')
	else:
		print('YES')
		a1 = []
		a2 = []
		for i in range(2, n + 1, 2):
			a1.append(i)
		for i in range(1, n - 1, 2):
			a2.append(i)
		ans = a1 + a2 + [s]
		print(*ans)


def solve(arr, s, k):
	hs = s // 2
	bal = max(arr)
	unchanged1 = [0] * (bal + k + 2)
	unchanged2 = [0] * (bal + k + 2)
	for i in range(hs):
		smax = max(arr[i], arr[s - 1 - i]) + k
		smin = min(arr[i], arr[s - 1 - i]) + 1
		unchanged1[smin] += 1
		unchanged1[smax + 1] -= 1
		unchanged2[arr[i] + arr[s - 1 - i]] += 2
	for i in range(1, bal + k + 2):
		unchanged1[i] += unchanged1[i - 1]
	for i in range(1, bal + k + 1):
		if unchanged2[i] > 0:
			unchanged1[i] += unchanged2[i] // 2
	mans = 0
	for i in range(1, bal + k + 1):
		mans = max(mans, unchanged1[i], unchanged2[i])
	return s - mans
tc = int(input())
fun = solve
ans = ''
for ll in range(tc):
	(_, k) = map(int, input().split())
	li = [int(x) for x in input().split()]
	fun(li, _, k)
	ans += '{}\n'.format(fun(li, _, k))
print(ans)


t = int(input())
x = []
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		x.append('NO')
		continue
	a1 = [j for j in range(2, n + 1, 2)]
	a2 = [j for j in range(1, n - 1, 2)]
	a = a1 + a2
	a.append(sum(a1) - sum(a2))
	x.append('YES')
	x.append(a)
for i in x:
	if i == 'YES' or i == 'NO':
		print(i)
	else:
		for j in i:
			print(j, end=' ')
		print()


import math
n = int(input())
d = []

def check(p):
	x = []
	p = int(p / 2)
	sum = math.pow(p, 2) + p
	for i in range(1, p + 1):
		x.append(str(2 * i))
	for i in range(1, p):
		x.append(str(2 * i - 1))
		sum -= int(x[-1])
	x.append(str(int(sum)))
	return x
for i in range(n):
	b = int(input())
	if b % 4 != 0:
		d.append('NO')
	else:
		d.append(['YES', check(b)])
for u in d:
	if u == 'NO':
		print(u)
	else:
		print('YES')
		print(' '.join(u[1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	dic1 = {}
	li = [0] * (2 * k + 2)
	ar = list(map(int, input().split()))
	for i in range(n // 2):
		x = ar[i]
		y = ar[-(i + 1)]
		big = max(x, y)
		sma = min(x, y)
		x = x + y
		if x in dic1:
			dic1[x] += 1
		else:
			dic1[x] = 1
		li[sma + 1] += 1
		li[big + k + 1] -= 1
	for i in range(1, 2 * k + 2):
		li[i] += li[i - 1]
	br = []
	for j in range(1, 2 * k + 2):
		br.append(li[j] - dic1.get(j, 0) + (n // 2 - li[j]) * 2)
	print(min(br))


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		par = []
		impar = []
		diferenca = 0
		for a in range(1, int(n / 2) + 1):
			par.append(a * 2)
		for a in range(int(n / 2) - 1):
			impar.append(par[a] - 1)
			diferenca += 1
		impar.append(par[int(n / 2) - 1] + diferenca)
		impar.sort()
		par.sort()
		for a in range(int(n / 2)):
			print(par[a], end=' ')
		for a in range(int(n / 2)):
			print(impar[a], end=' ')
		print('')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	changes = [0 for _ in range(2 * k + 2)]
	row = [int(g) for g in input().split(' ')]
	totals = [row[i] + row[n - 1 - i] for i in range(len(row) // 2)]
	for i in range(len(row) // 2):
		tot = row[i] + row[n - 1 - i]
		max_val = max(row[i], row[n - 1 - i]) + k
		min_val = min(row[i], row[n - 1 - i]) + 1
		changes[min_val] -= 1
		changes[max_val + 1] += 1
		changes[tot] -= 1
		changes[tot + 1] += 1
	current = 0
	min_value = float('inf')
	for change in changes[2:2 * k + 1]:
		current += change
		min_value = min(min_value, current)
	print(n + min_value)


def wa():
	s2 = ''
	s3 = ''
	sum = 0
	l = []
	for i in range(1, 100, 1):
		if i % 2 != 0:
			l.append(i)
	return l

def ans(a):
	s = ''
	s2 = ''
	s3 = ''
	sum = a // 2
	f = 0
	f1 = 0
	g = 1
	if sum % 2 == 0:
		print('YES')
		for i in range(1, a + 1, 1):
			if i % 2 == 0:
				f += i
				print(i, end=' ')
		for i in range(0, sum - 1, 1):
			f1 += g
			print(g, end=' ')
			g += 2
		print(abs(f - f1))
	else:
		print('NO')
t = int(input())
while t > 0:
	a = int(input())
	ans(a)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = []
		b = []
		l = n // 2
		for j in range(2, n + 2, 2):
			a.append(j)
		s1 = 0
		for k in range(0, l - 1):
			s1 += a[k]
		for j in range(1, n - 1, 2):
			b.append(j)
		s2 = sum(b)
		d1 = s1 - s2
		elem = a[l - 1]
		bel = elem + d1
		b.append(bel)
		a.extend(b)
		print('YES')
		print(*a)


n = int(input())
res = []
for i in range(n):
	n = int(input())
	a = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		m = int(n / 2)
		s = 0
		s2 = 0
		c = 2
		c1 = 1
		for j in range(m):
			s += c
			a.append(c)
			c += 2
		for k in range(m):
			if k != m - 1:
				s2 += c1
				a.append(c1)
				c1 += 2
			else:
				a.append(s - s2)
		print('YES')
		for p in a:
			print(p, end=' ')
		a = []


t = int(input())
for case in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		k = n // 4
		answer = [2 * x for x in range(1, 2 * k + 1)] + [2 * x - 1 for x in range(1, 2 * k)] + [3 * n // 2 - 1]
		print('YES')
		print(*answer)


from bisect import bisect_left, bisect_right
from collections import Counter

def find(arr, N, K):
	pre = [0] * (2 * K + 2)
	A = []
	cf = Counter()
	for i in range(N // 2):
		j = N - i - 1
		(a, b) = sorted([arr[i], arr[j]])
		pre[a + 1] -= 1
		pre[b + K + 1] += 1
		cf[a + b] += 1
	pre[0] = N
	for i in range(1, 2 * K + 2):
		pre[i] += pre[i - 1]
	for i in cf:
		pre[i] -= cf[i]
	return min(pre)

def main():
	for i in range(int(input())):
		(N, K) = list(map(int, input().split()))
		arr = list(map(int, input().split()))
		print(find(arr, N, K))
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO', end='')
	else:
		el = []
		ol = []
		i = 2
		for j in range(n // 2):
			el.append(i)
			if j != n // 2 - 1:
				ol.append(i - 1)
			else:
				ol.append(i + n // 2 - 1)
			i += 2
		print('YES')
		for i in el:
			print(i, end=' ')
		for i in ol:
			print(i, end=' ')
	print()


n = int(input())
for i in range(n):
	test = int(input())
	t = test / 2
	if t % 2 != 0:
		print('NO')
	else:
		print('YES')
		even = []
		odd = []
		for j in range(1, test + 1):
			if j % 2 == 0:
				even.append(j)
			else:
				odd.append(j)
		t = odd.pop()
		odd.append(t + int(test / 2))
		res = even + odd
		print(*res, sep=' ')


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		b = []
		a11 = 1000000000 - 2
		b11 = a11 + 1
		a1 = 2
		a2 = 1
		for i in range(n // 2 // 2):
			b.append(b11)
			b.append(a2)
			b11 -= 2
			a2 += 2
			a.append(a11)
			a.append(a1)
			a11 -= 2
			a1 += 2
		print(*a, *b)


from sys import stdin, exit, setrecursionlimit
from collections import deque
from heapq import *
from math import gcd
from math import ceil, log2
setrecursionlimit(10000000)
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	arr = []
	arr2 = []
	cur = 2
	for i in range(n // 4):
		arr.append(cur)
		arr.append(cur + 2)
		arr2.append(cur - 1)
		arr2.append(cur + 3)
		cur += 6
	print('YES')
	print(*arr + arr2)


def not_valid_number(number: int) -> bool:
	return not number / 2 % 2 == 0

def valid_number_generator(input_number: int) -> str:
	even_set: list = [2]
	odd_set: list = [1]
	for i in range(3, input_number, 2):
		even_set.append(i + 1)
		odd_set.append(i)
	even_sum = int(input_number / 2)
	odd_set[-1] = even_sum * (even_sum + 1) + odd_set[-1] - sum(odd_set)
	return ' '.join(map(str, even_set + odd_set))
result = []
number_of_test: int = int(input())
while number_of_test > 0:
	input_number: int = int(input())
	if not_valid_number(input_number):
		result.append('NO')
	else:
		result.append('YES')
		result.append(valid_number_generator(input_number))
	number_of_test -= 1
for i in result:
	print(i)


import math
for _ in range(int(input())):
	n = int(input())
	ans = []
	if n // 2 % 2 == 1:
		print('NO')
	else:
		odd = []
		even = []
		for i in range(n // 2):
			x = n - i - 1
			y = n + i + 1
			if x % 2 == 0:
				even.append(x)
			else:
				odd.append(x)
			if y % 2 == 0:
				even.append(y)
			else:
				odd.append(y)
		for i in odd:
			even.append(i)
		print('YES')
		print(*even)


for nt in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = []
	d = {}
	for i in range(n // 2):
		a = l[i] + l[n - i - 1]
		s.append((a, i))
		if a in d:
			d[a] += 1
		else:
			d[a] = 1
	s.sort()
	if s[0][0] == s[-1][0]:
		print(0)
		continue
	r = []
	start = {}
	end = {}
	for i in range(n // 2):
		m1 = max(l[i], l[n - i - 1])
		m2 = min(l[i], l[n - i - 1])
		if m2 + 1 in start:
			start[m2 + 1] += 1
		else:
			start[m2 + 1] = 1
		if m1 + k in end:
			end[m1 + k] += 1
		else:
			end[m1 + k] = 1
	if 2 not in start:
		start[2] = 0
	if 2 not in end:
		end[2] = 0
	for i in range(3, 2 * k + 1):
		if i not in start:
			start[i] = start[i - 1]
		else:
			start[i] += start[i - 1]
		if i not in end:
			end[i] = end[i - 1]
		else:
			end[i] += end[i - 1]
	ans = 0
	if 2 in d:
		ans = 2 * (n // 2 - start[2]) - d[2] + start[2]
	else:
		ans = 2 * (n // 2 - start[2]) + start[2]
	for i in range(3, 2 * k + 1):
		if i in d:
			ans = min(ans, 2 * (n // 2 - start[i] + end[i - 1]) - d[i] + start[i] - end[i - 1])
		else:
			ans = min(ans, 2 * (n // 2 - start[i] + end[i - 1]) + start[i] - end[i - 1])
	print(ans)


n = int(input())
for i in range(n):
	n1 = int(input())
	if n1 % 4 == 0:
		a = []
		a1 = []
		a2 = []
		for i1 in range(2, n1 + 1, 2):
			a1.append(i1)
		for i2 in range(1, n1, 2):
			a2.append(i2)
		s1 = sum(a1)
		s2 = sum(a2)
		diff = s1 - s2
		diff1 = a2[-1] + diff
		a2[-1] = diff1
		s22 = sum(a2)
		if s1 == s22:
			print('YES')
			a = a1 + a2
			print(' '.join(map(str, a)))
	else:
		print('NO')


T = int(input())
while T > 0:
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	count = [0] * (2 * k + 2)
	for i in range(n // 2):
		count[2] += 2
		(x, y) = sorted([arr[i], arr[n - i - 1]])
		count[x + 1] -= 1
		count[x + y] -= 1
		count[x + y + 1] += 1
		count[y + k + 1] += 1
	for i in range(2, len(count)):
		count[i] += count[i - 1]
	print(min(count[2:]))
	T -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	stats = {}
	for i in range(n // 2):
		(a1, an) = (a[i], a[n - i - 1])
		x = a1 + an
		stats[x - max(a1, an) + 1] = stats.get(x - max(a1, an) + 1, 0) - 1
		stats[x] = stats.get(x, 0) - 1
		stats[x + 1] = stats.get(x + 1, 0) + 1
		stats[x + (k - min(a1, an)) + 1] = stats.get(x + (k - min(a1, an)) + 1, 0) + 1
	min_sum = n
	cur_sum = n
	for (k, diff) in sorted(stats.items(), key=lambda xx: xx[0]):
		cur_sum += diff
		if cur_sum < min_sum:
			min_sum = cur_sum
	print(min_sum)


x = int(input())
for i in range(x):
	length = int(input())
	if length / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		evens = [j for j in range(2, length + 1, 2)]
		odds = [j for j in range(1, length - 1, 2)]
		last = sum(evens) - sum(odds)
		m = evens + odds
		m.append(last)
		m = ' '.join(map(str, m))
		print(m)


from collections import *
from bisect import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		f = 0
		for i in range(n // 2):
			print((i + 1) * 2, end=' ')
			f += (i + 1) * 2
		s = -1
		ff = []
		for i in range(n // 2 - 1):
			print(s + 2, end=' ')
			ff.append(s + 2)
			s += 2
		print(f - sum(ff))


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 2 or n // 2 % 2 != 0:
		print('NO')
	else:
		ar = []
		(s1, s2) = (0, 0)
		for i in range(2, n + 1, 2):
			ar.append(i)
			s1 += i
		for i in range(1, n - 1, 2):
			ar.append(i)
			s2 += i
		ar.append(abs(s1 - s2))
		print('YES')
		print(*ar)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n // 2 % 2:
		print('NO')
		continue
	list_a = [0] * n
	for i in range(n // 2):
		list_a[i] = 2 * (i + 1)
	for i in range(n // 2):
		list_a[i + n // 2] = 2 * (i + 1) - 1
	list_a[-1] += n // 2
	print('YES')
	print(*list_a)


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		arr = [i for i in range(2, n + 1, 2)]
		arr_sum = sum(arr)
		for i in range(1, n - 1, 2):
			arr.append(i)
			arr_sum -= i
		else:
			arr.append(arr_sum)
		print('YES')
		print(*arr)


t = int(input())
for x in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		z = []
		for x in range(n // 2):
			z.append(2 * (x + 1))
		d = []
		for x in range(n // 2 - 1):
			d.append(2 * (x + 1) - 1)
		d.append(sum(z) - sum(d))
		print(' '.join(map(str, z)), ' '.join(map(str, d)))
	else:
		print('NO')


def A():
	n = int(input())
	for i in range(n):
		num = int(input())
		if num // 2 % 2 == 0:
			print('YES')
			for i in range(1, num // 2 + 1):
				print(2 * i, end=' ')
			for i in range(1, num // 2):
				print(2 * i - 1, end=' ')
			print(num + num // 2 - 1)
		else:
			print('NO')
A()


t = int(input())
for _ in range(t):
	a = []
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		sum1 = 0
		sum2 = 0
		for i in range(1, n // 2 + 1):
			sum1 += i * 2
			a.append(str(i * 2))
		for i in range(n // 2 - 1):
			sum2 += i * 2 + 1
			a.append(str(i * 2 + 1))
		a.append(str(sum1 - sum2))
		print('YES')
		print(' '.join(a))


t = int(input())
for _ in range(t):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
		continue
	print('YES')
	for x in range(2, (n << 1) + 1, 2):
		print(x, end=' ')
	for x in range(1, (n << 1) - 1, 2):
		print(x, end=' ')
	print(x + 2 + n)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		ans = []
		for i in range(n // 4):
			ans.append(6 * i + 2)
			ans.append(6 * i + 4)
		for i in range(n // 4):
			ans.append(6 * i + 1)
			ans.append(6 * i + 5)
		print(' '.join(map(str, ans)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		su = 0
		for j in range(2, n + 2, 2):
			print(j, end=' ')
			su = su + j
		for j in range(1, n - 1, 2):
			print(j, end=' ')
		print(su - pow(n // 2 - 1, 2))


t = int(input())
count = 0
while count < t:
	count += 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = 2
		while k <= n:
			print(k, end=' ')
			k += 2
		k = 1
		while k < n - 2:
			print(k, end=' ')
			k += 2
		print(int(k + n / 2))


for i in range(int(input().strip())):
	n = int(input().strip())
	if n % 4 == 0:
		print('YES')
		array = []
		for i in range(1, int(n / 2 + 1)):
			array.append(str(2 * i))
		for i in range(1, int(n / 4 + 1)):
			array.append(str(2 * i - 1))
		for i in range(int(n / 4 + 1), int(n / 2 + 1)):
			array.append(str(2 * i + 1))
		print(' '.join(array))
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0 and n >= 4:
		a = [2]
		y = (n + 1) // 2
		z = (n + 1) // 4
		for i in range(1, y):
			a.append(a[i - 1] + 2)
		for i in range(y, y + z):
			a.append(a[i - y] - 1)
		for i in range(y + z, n):
			a.append(a[i - y] + 1)
		print('YES')
		print(*a)
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		sum = 0
		first_half = [0] * (n // 2)
		for i in range(n // 2):
			first_half[i] = (i + 1) * 2
			sum += (i + 1) * 2
		second_half = [0] * (n // 2)
		for i in range(n // 2 - 1):
			second_half[i] = (i + 1) * 2 - 1
			sum -= (i + 1) * 2 - 1
		second_half[-1] = sum
		result = [0] * n
		for i in range(n // 2):
			result[i] = first_half[i]
			result[i + n // 2] = second_half[i]
		print(' '.join([str(elem) for elem in result]))


t = int(input())
for i in range(1, t + 1):
	n = int(input())
	a = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		s = 0
		h = n // 2
		for i in range(2, h * 2 + 1, 2):
			a.append(i)
			s += i
		x = 1
		i = 0
		while i < h - 1:
			a.append(x)
			s -= x
			x += 2
			i += 1
		a.append(s)
		print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		summ = 0
		even = 0
		odd = 1
		for x in range(n // 2):
			even += 2
			print(even, end=' ')
			summ += even
		s = 0
		for x in range(n // 2):
			if x == n // 2 - 1:
				print(summ)
				break
			print(odd, end=' ')
			s += odd
			summ -= odd
			odd += 2


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	z = 2
	z1 = 1
	if n % 4 == 0:
		for j in range(n):
			if j <= n // 2 - 1:
				a.append(z)
				z += 2
			elif j == n - 1:
				a.append(z1 + n // 2)
			else:
				a.append(z1)
				z1 += 2
		print('YES')
		print(*a)
	else:
		print('NO')


def main():
	from collections import Counter
	from itertools import accumulate
	T = int(input())
	for _ in range(T):
		(N, K) = (int(i) for i in input().split())
		A = [int(i) for i in input().split()]
		c = Counter()
		for i in range(N // 2):
			c[A[i] + A[-(i + 1)]] += 1
		S = [0] * (2 * K + 5)
		for i in range(N // 2):
			mi = min(A[i], A[-(i + 1)]) + 1
			ma = max(A[i], A[-(i + 1)]) + K
			S[mi] += 1
			S[ma + 1] -= 1
		S = list(accumulate(S))
		ans = 3 * 10 ** 5
		for x in range(2, 2 * K + 1):
			cur = S[x] - c[x] + (N // 2 - S[x]) * 2
			ans = min(ans, cur)
		print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		c = 0
		k = []
		for i in range(2, n + 1, 2):
			a.append(i)
			if c < x - 1:
				k.append(i - 1)
				c += 1
		x = sum(a) - sum(k)
		a = a + k
		a.append(x)
		for i in range(len(a)):
			print(a[i], end=' ')
		print()


for y in range(int(input())):
	lst = []
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for i in range(n // 2):
			lst.append((i + 1) * 2)
		lst2 = []
		a = 0
		b = len(lst) - 1
		for i in range(n // 4):
			lst2.append(lst[a] - 1)
			lst2.append(lst[b] + 1)
			a += 1
			b -= 1
		lst2.sort()
		lst += lst2
		for i in lst:
			print(i, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	evenlist = []
	oddlist = []
	if n * (n + 1) / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			if i % 2 == 0:
				evenlist.append(i)
		r = sum(evenlist)
		t = 0
		p = 0
		for j in range(1, 2 * n, 2):
			oddlist.append(j)
			if len(oddlist) == n // 2 - 1:
				break
		oddlist.append(r - sum(oddlist))
		print(*evenlist + oddlist)


for t in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO')
	elif int(n / 2) % 2 == 0:
		print('YES')
		k = [i for i in range(1, n + 1)]
		arr1 = k[1:n + 1:2]
		arr2 = k[0:n + 1:2]
		a = sum(arr1)
		b = sum(arr2)
		del arr2[-1]
		arr2.append(sum(arr1) - sum(arr2))
		for i in arr1:
			print(i, end=' ')
		for i in arr2:
			print(i, end=' ')
		print()
	else:
		print('NO')


cases = int(input())
for case in range(cases):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	n //= 2
	print('YES')
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for j in range(1, n + 1):
		if j == n:
			print(j * 2 - 1 + n)
		else:
			print(j * 2 - 1, end=' ')


def solution(n):
	if n % 4 != 0:
		print('NO')
	else:
		f = lambda i, n: i * 6 + n
		even = [f(i, n) for i in range(n // 4) for n in (2, 4)]
		odd = [f(i, n) for i in range(n // 4) for n in (1, 5)]
		print('YES')
		print(' '.join(map(str, even + odd)))
for _ in range(int(input())):
	solution(int(input()))


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	firsthalf = [i for i in range(2, n + 1, 2)]
	secondhalf = list()
	for i in range(n // 2):
		if i < n // 4:
			secondhalf.append(firsthalf[i] - 1)
		else:
			secondhalf.append(firsthalf[i] + 1)
	firsthalf += secondhalf
	for i in firsthalf:
		print(i, end=' ')
	print()


t = int(input())
for n in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		d = []
		t = []
		for i in range(2, n + 2, 2):
			d.append(i)
		y = sum(d)
		for j in range(len(d) - 1):
			x = d[j] - 1
			t.append(x)
		z = sum(d) - sum(t)
		t.append(z)
		print(*d + t)
	else:
		print('NO')


t = int(input())
import math
delay = []
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		amt = n // 2
		start = [2 * int(i) for i in range(1, amt + 1)]
		end = [2 * int(i) + 1 for i in range(amt - 1)]
		end += [sum(start) - sum(end)]
		print('YES')
		total = start + end
		total = [str(s) for s in total]
		print(' '.join(total))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		ans = []
		for i in range(2, n + 1, 2):
			ans.append(i)
		temp1 = sum(ans)
		temp2 = 0
		for i in range(len(ans) - 1):
			ans.append(ans[i] - 1)
			temp2 += ans[i] - 1
		ans.append(abs(temp1 - temp2))
		print('YES')
		print(*ans)


def printResult():
	l = []
	m = int(input())
	if m % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(m / 2) + 1):
			l.append(i * 2)
		for i in range(1, int(m / 2)):
			l.append(i * 2 - 1)
		l.append(int(m / 2) * 3 - 1)
		for _ in l:
			print(_, end=' ')
n = int(input())
for i in range(n):
	printResult()


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	if x & 1 == 1:
		print('NO')
		continue
	print('YES')
	even = [2]
	odd = [1]
	for i in range(1, x):
		even.append(even[-1] + 2)
		odd.append(odd[-1] + 2)
	esum = sum(even)
	osum = sum(odd)
	odd[-1] = odd[-1] + abs(esum - osum)
	for i in even:
		print(i, end=' ')
	for i in odd:
		print(i, end=' ')
	print()


def main():
	for _ in range(int(input())):
		n = int(input())
		if n & 2:
			print('NO')
		else:
			print('YES')
			print(*range(2, n + 2, 2), *range(1, n - 1, 2), n + n // 2 - 1)
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		l = []
		s = 0
		s1 = 0
		k = 2
		while k < n + 1:
			l.append(k)
			s += k
			k += 2
		k = 1
		while k < n - 2:
			l.append(k)
			s1 += k
			k += 2
		l.append(s - s1)
		print(*l)


import sys
input = sys.stdin.readline
t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
		for i in range(n // 2 - 1):
			print(i * 2 + 1, end=' ')
		print(n + n // 2 - 1)


test = int(input())
for i in range(test):
	sum = int(input())
	if (sum >> 1) % 2 == 1:
		print('NO')
	else:
		print('YES')
		sum = sum >> 1
		for i in range(1, sum + 1):
			print(2 * i, end=' ')
		for i in range(1, sum):
			print(2 * i - 1, end=' ')
		print(sum * 3 - 1, end='\n')


import sys
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	cnt = [0 for i in range(2 * k + 1)]
	for j in range(n // 2):
		cnt[arr[j] + arr[n - j - 1]] += 1
	pref = [0 for j in range(2 * k + 2)]
	for j in range(0, n // 2):
		l1 = 1 + arr[j]
		l2 = 1 + arr[n - j - 1]
		r1 = arr[j] + k
		r2 = arr[n - j - 1] + k
		if max(l1, l2) > min(r1, r2):
			continue
		pref[min(l1, l2)] += 1
		pref[max(r1, r2) + 1] -= 1
	for j in range(1, 2 * k + 2):
		pref[j] += pref[j - 1]
	ans = sys.maxsize
	for j in range(2, 2 * k + 1):
		ans = min(ans, pref[j] - cnt[j] + (n // 2 - pref[j]) * 2)
	print(ans)


import sys, math
input = sys.stdin.buffer.readline
T = int(input())
for testcase in range(T):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	x = [0] * (2 * k + 5)
	for i in range(n // 2):
		(p, q) = (a[i], a[n - 1 - i])
		if p > q:
			(p, q) = (q, p)
		x[0] += 2
		x[p + 1] -= 1
		x[p + q] -= 1
		x[p + q + 1] += 1
		x[q + k + 1] += 1
	tmp = 0
	for i in range(2 * k + 5):
		tmp += x[i]
		x[i] = tmp
	print(min(x))


t = int(input())
while t > 0:
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		a = 2
		su = 0
		for i in range(n // 2):
			l.append(a)
			su += a
			a += 2
		b = 1
		s = 0
		for i in range(n // 2 - 1):
			l.append(b)
			s += b
			b += 2
		l.append(su - s)
		for i in l:
			print(i, end=' ')
		print()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('No')
	else:
		arr = [2, 4, 1, 5]
		j = n // 2
		i = 0
		val = [0] * n
		print('Yes')
		while i < n // 2:
			val[i] = arr[0]
			i += 1
			val[i] = arr[1]
			val[j] = arr[2]
			j += 1
			val[j] = arr[3]
			for k in range(4):
				arr[k] += 6
			j += 1
			i += 1
		for i in range(n):
			print(val[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		(eve, odd) = ([0 for i in range(n // 2)], [0 for i in range(n // 2)])
		i = 1
		(j, k) = (0, 0)
		while i <= n - 2:
			if i % 2 == 0:
				eve[j] = i
				j += 1
			else:
				odd[k] = i
				k += 1
			i += 1
		eve[-1] = i + 1
		odd[-1] = eve[-1] + (n // 2 - 1)
		print('YES')
		print(' '.join((str(i) for i in eve + odd)))
	else:
		print('NO')


def Sol(n):
	mid = int(n / 2)
	if mid % 2 != 0:
		print('NO')
		return
	ans = []
	se = 0
	for i in range(mid):
		ans.append(2 * (i + 1))
		se += 2 * (i + 1)
	so = 0
	for e in range(mid - 1):
		ans.append(2 * e + 1)
		so += 2 * e + 1
	ans.append(se - so)
	print('YES')
	for i in ans:
		print(i, end=' ')
	print()
	return
for t in range(int(input())):
	Sol(int(input()))


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		odd = []
		even = []
		curr = 2
		for i in range(n // 2):
			even.append(str(curr))
			if i % 2 == 0:
				odd.append(str(curr - 1))
			else:
				odd.append(str(curr + 1))
			curr += 4
		print('YES')
		print(' '.join(even) + ' ' + ' '.join(odd))


def solve(N):
	n = N // 2
	if n % 2:
		return ('NO', [])
	ret = []
	ret += [i * 2 + 2 for i in range(n)]
	ret += [i * 2 + 1 if i < n // 2 else i * 2 + 3 for i in range(n)]
	return ('YES', ret)

def main():
	tc = int(input())
	for _ in range(tc):
		n = int(input())
		(flag, ans) = solve(n)
		print(flag)
		if ans:
			for i in ans:
				print(i, end=' ')
			print()
main()


t = int(input())
out = ''
while t > 0:
	t -= 1
	n = int(input())
	if n // 2 % 2 == 1:
		out += 'NO\n'
		continue
	e = set()
	o = set()
	s_e = 0
	s_o = 0
	for i in range(2, n + 1, 2):
		e.add(i)
		s_e += i
	for i in range(1, n - 1, 2):
		o.add(i)
		s_o += i
	if s_e - s_o in o:
		out += 'NO\n'
		continue
	out += 'YES\n'
	out += ' '.join((str(x) for x in [*e, *o, s_e - s_o]))
	out += '\n'
print(out)


for _ in range(int(input())):
	a = int(input())
	ans = ''
	s = 0
	e = 0
	if a / 2 % 2 == 0:
		print('YES')
		for i in range(2, a + 1):
			if i % 2 == 0:
				print(i, end=' ')
				s += i
		for i in range(1, a - 2):
			if i % 2 != 0:
				print(i, end=' ')
				e += i
		print(s - e, end=' ')
	else:
		print('NO')


t = int(input())
for asd in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	answer = []
	a = 2
	for i in range(int(n / 2)):
		answer.append(a)
		a += 2
	a = 1
	for i in range(int(n / 2) - 1):
		answer.append(a)
		a += 2
	a = answer[int(n / 2) - 1] + int(n / 2) - 1
	answer.append(a)
	for i in answer:
		print(i, end=' ')
	print()


T = int(input())
for i in range(T):
	N = int(input())
	check = N / 2
	if check % 2 != 0:
		print('NO')
	else:
		print('YES')
		Sum1 = 0
		for j in range(1, int(N / 2 + 1)):
			Sum1 += j * 2
			print(j * 2, end=' ')
		k = 1
		Sum2 = 0
		for j in range(1, int(N / 2)):
			print(k, end=' ')
			Sum2 += k
			k += 2
		last = Sum1 - Sum2
		print(last)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	a = []
	for i in range(n // 4):
		a.append(i * 6 + 2)
		a.append(i * 6 + 6)
	for i in range(n // 4):
		a.append(i * 6 + 3)
		a.append(i * 6 + 5)
	print('YES')
	print(' '.join(map(str, a)))


T = int(input())
for _ in range(1, T + 1):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	fa = [x * 2 for x in range(1, n // 2 + 1)]
	sa = [1 + x * 2 for x in range(0, n // 2 - 1)]
	sf = sum(fa)
	ss = sum(sa)
	sa.append(sf - ss)
	print('YES')
	print(*fa, *sa)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
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
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

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)]
for _ in range(int(data())):
	(n, k) = sp()
	arr = l()
	diff = dd(int)
	temp = dd(int)
	for i in range(n // 2):
		diff[arr[i] + arr[n - i - 1]] += 1
		low = 1 + min(arr[i], arr[n - i - 1])
		high = k + max(arr[i], arr[n - i - 1])
		temp[low] += 1
		temp[high + 1] -= 1
	for i in range(1, 2 * k + 2):
		temp[i] += temp[i - 1]
	answer = n // 2
	for i in range(2, 2 * k + 1):
		answer = min(answer, temp[i] + 2 * (n // 2 - temp[i]) - diff[i])
	outln(answer)


from collections import *
from bisect import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	r = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		x = a[i]
		y = a[n - i - 1]
		st = min(x, y) + 1
		end = min(2 * k, max(x, y) + k)
		r[st] -= 1
		if end != 2 * k:
			r[end + 1] += 1
		if st != 2:
			r[2] -= 2
			r[st] += 2
		if end != 2 * k:
			r[end + 1] -= 2
	for i in range(1, 2 * k + 2):
		r[i] += r[i - 1]
	for i in range(n // 2):
		r[a[i] + a[n - i - 1]] += 1
	x = max(r[2:-1])
	if x >= 0:
		print(0)
	else:
		print(abs(x))


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		print(*range(2, n + 1, 2), *range(1, n - 1, 2), 3 * n // 2 - 1)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		(i, x, s1) = (1, 2, 0)
		while i <= n // 2:
			print(x, end=' ')
			s1 += x
			x += 2
			i += 1
		(i, x, s2) = (1, 1, 0)
		while i <= n // 2 - 1:
			print(x, end=' ')
			s2 += x
			x += 2
			i += 1
		print(s1 - s2)


def compute(n):
	arr = []
	if n // 2 % 2 != 0:
		print('NO', end='')
	else:
		cur_even = 2
		cur_odd = 1
		cur_sum_even = 0
		cur_sum_odd = 0
		for _ in range(n // 2):
			cur_sum_even += cur_even
			arr.append(cur_even)
			cur_even += 2
		for i in range(n // 2 - 1):
			cur_sum_odd += cur_odd
			arr.append(cur_odd)
			cur_odd += 2
		cur_odd = cur_sum_even - cur_sum_odd
		arr.append(cur_odd)
		print('YES')
		for i in arr:
			print(i, end=' ')
t = int(input())
for _ in range(t):
	n = int(input())
	compute(n)
	print()


def fun(s):
	if s // 2 % 2 == 0:
		print('YES')
		l = [0 for i in range(s)]
		x = 2
		m = s // 2
		for i in range(s // 2):
			l[i] = x
			if i % 2 == 0:
				l[m + i] = x - 1
				x += 2
			else:
				l[m + i] = x + 1
				x += 4
		for i in range(s):
			print(l[i], end=' ')
		print()
	else:
		print('NO')
for T in range(int(input())):
	s = int(input())
	fun(s)


o = int(input(''))
p = 0
while p < o:
	n = int(input(''))
	if n / 2 % 2 == 0:
		l = []
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(n + (n // 2 - 1))
	else:
		print('NO')
	p += 1


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0 or n == 0:
		print('NO')
	else:
		sume = 0
		num = 2
		numo = 1
		liste = []
		for j in range(0, n // 2):
			liste.append(num)
			sume += num
			num += 2
		rem = 0
		for j in range(n // 2, n - 1):
			liste.append(numo)
			rem += numo
			numo += 2
		liste.append(sume - rem)
		print('YES')
		print(*liste)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = [n] + [0] * k * 2
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		c[x] -= 1
		c[x + y - 1] -= 1
		c[x + y] += 1
		c[k + y] += 1
	for i in range(k * 2):
		c[i + 1] += c[i]
	print(min(c))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			le = [e for e in range(2, n + 1, 2)]
			lo = [o for o in range(1, n + 1, 2)]
			leSum = sum(le)
			loSum = sum(lo)
			while leSum > loSum:
				lo[-1] += 2 * n // 4
				loSum += 2 * n // 4
			if leSum == loSum:
				print('YES')
				print(' '.join([str(i) for i in le] + [str(i) for i in lo]))
main()


for i in range(int(input())):
	k = int(input())
	if k // 2 % 2 == 0:
		l = []
		p = 2
		h = 0
		for i in range(k // 2):
			l.append(p)
			h += p
			p += 2
		p = 1
		g = 0
		for i in range((k - 1) // 2):
			l.append(p)
			g += p
			p += 2
		l.append(h - g)
		print('YES')
		for i in l:
			print(i, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = []
		s = 0
		for i in range(n):
			if i == n - 1:
				a.append(s)
			elif i < n / 2:
				a.append(2 * (i + 1))
				s += a[i]
			else:
				a.append(2 * (i - int(n / 2)) + 1)
				s -= a[i]
		print('YES')
		[print(x, end=' ') for x in a]


for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		list_boi = []
		half = int(n / 2)
		step = n / 4
		alt_flag = False
		for j in range(0, half, 2):
			list_boi.append(2 * (j + 1))
			list_boi.append(2 * (j + 2))
			print(list_boi[j], end=' ')
			print(list_boi[j + 1], end=' ')
		alt_flag = False
		if step < 2:
			for j in range(0, half):
				alt_flag = not alt_flag
				if alt_flag:
					print(list_boi[j] - 1, end=' ')
				else:
					print(list_boi[j] + 1, end=' ')
		else:
			for j in range(0, half):
				if j % step == 0:
					alt_flag = not alt_flag
				if alt_flag:
					print(list_boi[j] - 1, end=' ')
				else:
					print(list_boi[j] + 1, end=' ')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		i = n // 4
		arr1 = []
		arr2 = []
		for i in range(i):
			arr1.extend([2 * i + 2, n - 2 * i + 2])
			arr2.extend([2 * i + 3, n - 2 * i + 1])
		arr1.extend(arr2)
		print('YES')
		print(*arr1)


no = int(input())
for i in range(no):
	n = int(input())
	aa = [0] * n
	if n % 4 == 0:
		print('YES')
		l = 0
		r = n // 2
		for i in range(n):
			if (i + 1) % 2 == 0:
				aa[l] = i + 1
				l += 1
			else:
				if i == n - 1:
					break
				aa[r] = i + 1
				r += 1
		aa[n - 1] = 3 * (n // 2) - 1
		print(*aa, sep=' ')
	else:
		print('NO')


def func(n):
	if n % 4 != 0:
		return 'NO'
	even = []
	odd = []
	even = [i for i in range(2, n + 1, 2)]
	odd = [i for i in range(1, n - 1, 2)]
	odd.append(sum(even) - sum(odd))
	total = even + odd
	output = 'YES\n'
	output += ' '.join(list(map(str, total)))
	return output

def main():
	t = int(input())
	n_list = [int(input()) for i in range(t)]
	n_list = map(func, n_list)
	for i in n_list:
		print(i)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		c = 2
		l = []
		for i in range(n // 2):
			l.append(c)
			c += 2
		le = len(l)
		for i in range(le - 1):
			o = l[i] - 1
			l.append(o)
		l.append(l[le - 1] + (le - 1))
		for i in range(len(l)):
			print(l[i], end=' ')
		print()


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	freq = []
	for i in range(2 * k + 2):
		freq.append(0)
	for i in range(n // 2):
		mi = min(a[i], a[n - 1 - i])
		mx = max(a[i], a[n - 1 - i])
		freq[2] += 2
		freq[mi + 1] -= 1
		freq[mi + mx] -= 1
		freq[mi + mx + 1] += 1
		freq[mx + k + 1] += 1
	ans = 1000000000
	cur = 0
	for i in range(2, 2 * k + 1):
		cur = cur + freq[i]
		if ans > cur:
			ans = cur
	print(ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		even = []
		odd = []
		for i in range(1, int(n / 2) + 1):
			even.append(2 * i)
			if i == n / 2:
				temp = sum(even) - sum(odd)
				odd.append(temp)
			else:
				odd.append(2 * i - 1)
		even.extend(odd)
		st = ' '.join((str(x) for x in even))
		print(st)


for i in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		k = n // 2
		r = []
		for i in range(k):
			r.append(2 * i + 2)
		for i in range(k - 1):
			r.append(2 * i + 1)
		r.append(3 * k - 1)
		print(*r)


t = int(input())
for tt in range(0, t):
	n = int(input())
	half = n // 2
	if half % 2 == 1:
		print('No')
	else:
		print('Yes')
		for i in range(1, half + 1):
			print(2 * i, end=' ')
		for i in range(1, half):
			print(2 * i - 1, end=' ')
		sumeven = half // 2 * (2 + 2 * half)
		last = sumeven - (half - 1) * (2 * (half - 1)) // 2
		print(last)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('No')
	else:
		temp = n // 2
		ans = [2 * (i + 1) for i in range(temp)]
		index = 0
		temp1 = temp // 2
		while index < temp1:
			ans.append(ans[index] - 1)
			index += 1
		while index < temp:
			ans.append(ans[index] + 1)
			index += 1
		print('Yes')
		print(*ans)


from itertools import accumulate
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = [0] * (k * 2 + 2)
	for i in range(n // 2):
		p = a[i]
		q = a[n - i - 1]
		c[p + q + 1] += 1
		c[max(p, q) + k + 1] -= 1
		c[max(p, q) + k + 1] += 2
		c[min(p, q) + 1] += 1
		c[p + q] -= 1
		c[2] += 2
		c[min(p, q) + 1] -= 2
	print(min(list(accumulate(c))[2:]))


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		(li, e, o) = ([], 2, 1)
		se = 0
		so = 0
		for i in range(1, n + 1):
			if i <= n // 2:
				li.append(e)
				se = se + e
				e = e + 2
			elif i == n:
				li.append(se - so)
			else:
				li.append(o)
				so = so + o
				o = o + 2
		print('YES')
		print(*li)


t = int(input())
for _ in range(t):
	n = int(input())
	half_n = int(n / 2)
	if half_n % 2 == 1:
		print('NO')
		continue
	print('YES')
	s1 = 0
	for i in range(half_n):
		i = (i + 1) * 2
		s1 += i
		print(i, end=' ')
	s2 = 0
	for i in range(half_n - 1):
		i = (i + 1) * 2 - 1
		s2 += i
		print(i, end=' ')
	print(s1 - s2)


c = int(input())
for i in range(c):
	x = int(input())
	if x / 2 % 2 == 0:
		print('YES')
		l = [k for k in range(2, x + 1, 2)]
		m = [k for k in range(1, x - 1, 2)]
		q = sum(l) - sum(m)
		m.append(q)
		t1 = [str(k) for k in l]
		t2 = [str(k) for k in m]
		print(' '.join(t1 + t2))
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		r = 1
	else:
		print('YES')
		for j in range(2, n + 1, 2):
			print(j, end=' ')
		for j in range(1, n // 2):
			print(2 * j - 1, end=' ')
		print(2 * (n // 2) + (n // 2 - 1))


from math import *

def main():
	for _ in range(int(input())):
		n = int(input())
		if n % 4 == 0:
			print('YES')
			eve = n // 2
			odd = n // 2 - 1
			equ = eve * (eve + 1)
			don = odd * odd
			last = equ - don
			for i in range(1, eve + 1):
				print(2 * i, end=' ')
			for j in range(odd):
				print(2 * j + 1, end=' ')
			print(last, end=' ')
			print()
		else:
			print('NO')
main()


T = int(input())
for t in range(T):
	N = int(input())
	if N % 4 == 0:
		print('YES')
		lst = []
		temp = int(N / 2)
		for i in range(1, temp + 1):
			lst.append(2 * i)
		for i in range(temp - 1):
			lst.append(i * 2 + 1)
		lst.append((temp + 1) * temp - (temp - 1) ** 2)
		print(' '.join([str(i) for i in lst]))
	else:
		print('NO')


def balanced_array():
	cases = int(input())
	for i in range(cases):
		num = int(input())
		lista_pari = []
		lista_dispari = []
		for i in range(1, num - 1):
			if i % 2 == 0:
				lista_pari.append(i)
			else:
				lista_dispari.append(i)
		if len(lista_pari) == 0:
			lista_pari.append(2)
		else:
			lista_pari.append(lista_pari[len(lista_pari) - 1] + 2)
		pari = 0
		dispari = 0
		for i in lista_pari:
			pari += i
		for i in lista_dispari:
			dispari += i
		if (pari - dispari) % 2 == 1:
			numero = pari - dispari
			risultato = ''
			print('YES')
			for i in lista_pari:
				risultato += str(i) + ' '
			for i in lista_dispari:
				risultato += str(i) + ' '
			print(risultato + str(numero))
		else:
			print('NO')
balanced_array()


import sys
import math
from collections import defaultdict
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(input())
	nn = n >> 1
	s1 = nn * (nn + 1)
	s2 = 0
	if nn & 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, nn + 1):
			print(i << 1, end=' ')
		for i in range(1, nn):
			print((i << 1) - 1, end=' ')
			s2 += (i << 1) - 1
		print(s1 - s2)


T = int(input())
for test in range(T):
	N = int(input())
	if N % 4 != 0:
		print('NO')
		continue
	print('YES')
	evenarray = [2 * (i + 1) for i in range(N // 2)]
	oddarray = [2 * (i + 1) - 1 if i < N // 4 else 2 * (i + 1) + 1 for i in range(N // 2)]
	array = evenarray + oddarray
	print(' '.join(list(map(str, array))))


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		result = ''
		i = 2
		z1 = 0
		for _ in range(n // 2):
			result += f'{i} '
			z1 += i
			i += 2
		i = 1
		z2 = 0
		for _ in range(n // 2 - 1):
			result += f'{i} '
			z2 += i
			i += 2
		result += f'{z1 - z2}'
		print(result)


from collections import defaultdict

def solve(n, arr, k):
	mp = defaultdict(int)
	(size, ans) = (n // 2, float('inf'))
	prefix = [0] * (2 * k + 10)
	for i in range(size):
		(ai, pai) = (arr[i], arr[n - i - 1])
		x = ai + pai
		mp[x] += 1
	for i in range(size):
		(ai, pai) = (arr[i], arr[n - i - 1])
		left = min(ai, pai) + 1
		right = max(ai, pai) + k
		prefix[left] += 1
		prefix[right + 1] -= 1
	(start, end) = (2, 2 * k)
	for i in range(start, end + 1):
		prefix[i] = prefix[i] + prefix[i - 1]
	for x in range(start, end + 1):
		(zero_chng, one_chng) = (mp[x], prefix[x])
		two_chng = size - prefix[x]
		pos_ans = zero_chng * 0 + (one_chng - zero_chng) * 1 + two_chng * 2
		ans = min(ans, pos_ans)
	return ans
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(solve(n, arr, k))


for _ in range(int(input())):
	n = int(input())
	e = []
	o = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				e.append(i)
			else:
				o.append(i)
		l = e + o
		l[-1] = l[-1] + n // 2
		print(*l)


t = int(input())
a1 = []
for i in range(t):
	a1.append(int(input()))
for i in range(t):
	n = a1[i]
	if n % 4 != 0:
		print('NO')
	else:
		x = 2
		l1 = []
		l2 = []
		for i in range(int(n / 4)):
			l1.append(x)
			l1.append(x + 2)
			l2.append(x - 1)
			l2.append(x + 3)
			x = x + 6
		print('YES')
		for i in range(len(l1)):
			print(l1[i], end=' ')
		for i in range(len(l2)):
			print(l2[i], end=' ')
		print()


from collections import *
r = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(*a,) = map(int, input().split())
	c = defaultdict(list)
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[~i]))
		c[x + 1] += (-1,)
		c[x + y] += (-1,)
		c[x + y + 1] += (1,)
		c[k + y + 1] += (1,)
	t = n
	m = t
	for i in range(2, k * 2 + 1):
		for j in c[i]:
			t += j
		if t < m:
			m = t
	r += (m,)
print('\n'.join(map(str, r)))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n % 4 == 0:
			print('YES')
			ar = [0] * n
			x = 2
			for i in range(0, n // 2, 2):
				ar[i] = x
				ar[n - i - 1] = x - 1
				ar[i + 1] = x + 2
				ar[n - i - 2] = x + 3
				x += 6
			print(*ar)
		else:
			print('NO')
main()


respostas = []
testcase = int(input())

def lista(caso):
	primeira_metade = []
	segunda_metade = []
	par = 2
	impar = 1
	for ad in range(caso // 2):
		primeira_metade.append(par)
		segunda_metade.append(impar)
		par += 2
		impar += 2
	if sum(primeira_metade) != sum(segunda_metade):
		x = sum(primeira_metade) - sum(segunda_metade)
		segunda_metade[-1] += x
	result = primeira_metade + segunda_metade
	return result
for each in range(testcase):
	n = int(input())
	if n % 4 != 0:
		respostas.append('NO')
	elif n % 4 == 0:
		result = lista(n)
		respostas.append('YES')
		crc = ' '.join((str(num) for num in result))
		respostas.append(crc)
for resp in respostas:
	print(resp)


import collections

def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	evens = []
	odds = []
	evenSum = 0
	oddSum = 0
	for even in range(2, n + 1, 2):
		evens.append(even)
		evenSum += even
	for odd in range(1, n - 1, 2):
		odds.append(odd)
		oddSum += odd
	odds.append(evenSum - oddSum)
	print('YES')
	print(' '.join(map(str, evens + odds)))
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	solve(n)


test = int(input())
for _ in range(test):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		left = [2 * i for i in range(1, n // 2 + 1)]
		right = [2 * i + 1 for i in range(n // 2 - 1)]
		right.append(sum(left) - sum(right))
		print('YES')
		print(*left, *right)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		l = []
		c = 2
		for i in range(n // 2):
			l.append(c)
			c = c + 2
		n = len(l)
		for i in range(n // 2):
			l.append(l[i] - 1)
		for i in range(n // 2, n):
			l.append(l[i] + 1)
		print(*l)
	else:
		print('NO')


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		if N // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			A = [2 * i for i in range(1, N // 2 + 1)]
			sa = sum(A)
			sb = 0
			for i in range(N // 2 - 1):
				sb += i * 2 + 1
				A.append(i * 2 + 1)
			A.append(sa - sb)
			print(*A)
main()


t = int(input())
lst = list()
for a in range(t):
	n = int(input())
	lst.append(n)
for b in lst:
	if b % 4 == 0:
		print('YES')
		even = []
		odd = []
		i = 2
		j = 0
		while i <= b:
			even.append(i)
			i = i + 2
		l = len(even)
		while j < l - 1:
			z = even[j] - 1
			odd.append(z)
			j = j + 1
		odd.append(even[l - 1] + l - 1)
		whole = even + odd
		print(' '.join(map(str, whole)))
	else:
		print('NO')


def main():
	v = int(input())
	for i in range(v):
		c = int(input())
		if c // 2 % 2 != 0:
			print('NO')
		else:
			sz = c // 2
			e = 2 * c - 1
			s = 1
			odd = []
			even = []
			while len(odd) != sz:
				odd.append(e - 1)
				odd.append(s + 1)
				even.append(e)
				even.append(s)
				s += 2
				e -= 2
			print('YES')
			print(' '.join([str(vv) for vv in odd + even]))
main()


for _ in range(int(input())):
	n = int(input())
	arr = []
	x = 2
	s = 0
	for i in range(n // 2):
		s += x
		arr.append(x)
		x += 2
	x = 1
	for i in range(n // 2 - 1):
		arr.append(x)
		s -= x
		x += 2
	if s not in arr and s % 2 == 1:
		arr.append(s)
		print('YES')
		print(*arr)
	else:
		print('NO')


from collections import defaultdict
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	hashtable = defaultdict(int)
	prefix = [0] * (2 * k + 2)
	for i in range(n // 2):
		hashtable[l[i] + l[n - i - 1]] += 1
		prefix[min(l[i], l[n - i - 1]) + 1] += 1
		prefix[max(l[i], l[n - i - 1]) + k + 1] -= 1
	presum = 0
	for i in range(2 * k + 1):
		presum += prefix[i]
		prefix[i] = presum
	minreplace = 10 ** 6
	for i in range(2, 2 * k + 1):
		ch0 = hashtable[i]
		ch1 = prefix[i] - ch0
		ch2 = (n // 2 - ch1 - ch0) * 2
		minreplace = min(minreplace, ch1 + ch2)
	print(minreplace)


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = [0] * (2 * k + 2)
	d = {}
	for y in range(0, n // 2):
		l = min(l1[y], l1[n - y - 1]) + 1
		r = max(l1[y], l1[n - y - 1]) + k
		l2[l] += 1
		l2[r + 1] -= 1
		sum = l1[y] + l1[n - y - 1]
		if sum in d.keys():
			d[sum] += 1
		else:
			d[sum] = 1
	l1 = [l2[0]]
	for y in range(1, len(l2)):
		l1.append(l1[-1] + l2[y])
	m = 10000000
	for j in range(2, 2 * k + 1):
		a = 0
		c = 0
		if j in d.keys():
			a = d[j]
		b = l1[j] - a
		c = n // 2 - b - a
		if b + 2 * c < m:
			m = b + 2 * c
	print(m)


t = int(input())
for i in range(t):
	(count, i, j) = (0, 2, 1)
	n = int(input())
	arr1 = []
	arr2 = []
	(sum1, sum2) = [0] * 2
	while count < n // 2:
		arr1.append(i)
		count += 1
		sum1 += i
		i += 2
	count = 0
	while count < n // 2 - 1:
		arr2.append(j)
		count += 1
		sum2 += j
		j += 2
	if (sum1 - sum2) % 2 == 1:
		if sum1 - sum2 > j:
			arr2.append(sum1 - sum2)
			temp = sum1 - sum2
			sum2 += sum1 - sum2
	if sum1 == sum2:
		print('YES')
		for ele in arr1:
			print(ele, end=' ')
		for ele in arr2:
			print(ele, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	l = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		for j in range(2, n + 2, 2):
			l.append(j)
		lsum = sum(l)
		for j in range(1, n - 2, 2):
			l.append(j)
		lsumfinal = sum(l)
		l.append(abs(lsum - (lsumfinal - lsum)))
		print('YES')
		str1 = ' '.join((str(e) for e in l))
		print(str1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if int(n / 2) % 2 == 0:
		print('YES')
		i = 0
		x = 2
		sum_ = 0
		while i < int(n / 2):
			sum_ += x
			print(x, end=' ')
			x += 2
			i += 1
		x = 1
		i = 0
		sum__ = 0
		while i < int(n / 2) - 1:
			sum__ += x
			print(x, end=' ')
			x += 2
			i += 1
		print(sum_ - sum__)
	else:
		print('NO')


import math
test = int(input())
i = 1
while i <= test:
	n = int(input())
	half = n // 2
	mark = {}
	s1 = 1
	s2 = 2
	s3 = 5
	if half % 2 != 0:
		print('NO')
	else:
		print('YES')
		count = 0
		while count < half:
			print(s2, end=' ')
			s2 = s2 + 2
			count += 1
		count = 0
		c = True
		while count < half // 2:
			if c:
				print(s1, end=' ')
				print(s3, end=' ')
				mark[s1] = 1
				mark[s3] = 1
				if s1 + 2 not in mark:
					s1 += 2
					s3 += 6
				elif s1 + 4 not in mark:
					s1 += 4
					s3 += 4
				elif s1 + 6 not in mark:
					s1 += 6
					s3 += 2
			count += 1
		print()
	i += 1


test = int(input())
for t in range(test):
	(n, k) = list(map(int, input().split()))
	L = list(map(int, input().split()))
	sums = []
	d = {}
	ran = [0] * (2 * k + 2)
	for x in range(n // 2):
		a = L[x]
		b = L[n - x - 1]
		s = L[x] + L[n - x - 1]
		d[s] = d.get(s, 0) + 1
		ran[min(a, b) + 1] += 1
		ran[max(a, b) + k + 1] -= 1
	for i in range(2, 2 * k + 2):
		ran[i] += ran[i - 1]
	ans = n // 2
	for s in range(2, 2 * k + 1):
		ans = min(ans, ran[s] - d.get(s, 0) + (n // 2 - ran[s]) * 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	odd = []
	even = []
	if x % 2 == 0:
		for i in range(1, x + 1):
			even.append(2 * i)
		for j in range(1, x):
			odd.append(2 * j - 1)
		y = sum(even) - sum(odd)
		odd.append(y)
		ans = even + odd
		print('YES')
		print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		num = n // 2
		arr = [str(i) for i in range(2, 2 * num + 1, 2)]
		arr += [str(i) for i in range(1, 2 * num - 2, 2)]
		arr.append(str(3 * num - 1))
		print('YES')
		print(' '.join(arr))


T = int(input())
for _ in range(T):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		n = n >> 1
		a = [0] * (n + n)
		for i in range(1, n + 1):
			val = i + i
			a[i - 1] = val
			a[i + n - 1] = val - 1
		a[n + n - 1] += n
		print(' '.join(map(str, a)))


a = int(input())
for x in range(a):
	b = int(input())
	if b / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		c = []
		d = []
		for z in range(0, b // 2, 2):
			c.append(z + 1)
			d.append(z + 2)
		for z in range(b * 4 - 1, b * 4 - b // 2, -2):
			c.append(z)
			d.append(z - 1)
		e = d + c
		for z in e:
			print(z, end=' ')
		print()


t = int(input())
while t > 0:
	t -= 1
	a = int(input())
	if a % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		i = 2
		sum = 0
		while i <= a:
			print(i, end=' ')
			sum += i
			i += 2
		i = 1
		while i < a - 1:
			print(i, end=' ')
			sum -= i
			i += 2
		print(sum)


t = int(input())
for i in range(t):
	n = int(input())
	if n <= 2:
		print('NO')
	else:
		arr = []
		if n // 2 % 2 == 0:
			for j in range(2, n + 1, 2):
				arr.append(j)
			if len(arr) % 2 == 0:
				a = len(arr)
				b = len(arr) // 2
				for j in range(len(arr) // 2):
					arr.append(arr[j] - 1)
				for j in range(b, a):
					arr.append(arr[j] + 1)
			else:
				print('NO')
				continue
			print('YES')
			print(*arr)
		else:
			print('NO')


import random
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		e = 2
		for i in range(n // 2 - 1):
			print(e, end=' ')
			e += 2
		print(e + n // 2, end=' ')
		e = 3
		for i in range(n // 2):
			print(e, end=' ')
			e += 2
		print('')


def func():
	lists = []
	p = int(input())
	for i in range(p):
		n = int(input())
		lists.append(n)
	for n in lists:
		if n / 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			a = []
			even = []
			odd = []
			even_num = 2
			odd_num = 1
			for j in range(round(n / 2)):
				even.append(even_num)
				even_num = even_num + 2
			for j in range(round(n / 2) - 1):
				odd.append(odd_num)
				odd_num += 2
			odd.append(sum(even) - sum(odd))
			a = even + odd
			print(*a)
func()


T = int(input())
for t in range(T):
	n = int(input())
	nhalf = n // 2
	if nhalf % 2 == 0:
		print('YES')
		even = [*range(2, 2 * nhalf + 1, 2)]
		odd = [*range(1, 2 * nhalf + 1, 2)]
		odd[-1] = sum(even) - sum(odd[:-1])
		arr = even + odd
		for x in arr:
			print(x, end=' ')
		print('')
	else:
		print('NO')


import collections
import operator
n = int(input())
for i in range(n):
	mk = [int(i) for i in input().split(' ')]
	m = mk[0]
	k = mk[1]
	ll = [int(i) for i in input().split(' ')]
	rr = [0] * (2 * k + 2)
	pref = [0] * (2 * k + 2)
	lt = [0] * (2 * k + 2)
	for i in range(m // 2):
		rr[ll[i] + ll[m - 1 - i]] += 1
	for i in range(m // 2):
		a = min(ll[i] + 1, ll[m - 1 - i] + 1)
		b = max(ll[i] + k, ll[m - i - 1] + k) + 1
		pref[a] += 1
		pref[b] -= 1
	for i in range(1, 2 * k + 1):
		pref[i] += pref[i - 1]
	ans = m
	for i in range(2, 2 * k + 1):
		ans = min(ans, pref[i] - rr[i] + (m // 2 - pref[i]) * 2)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		half = n // 2
		ans = []
		for j in range(1, half + 1):
			ans.append(j * 2)
		for j in range(1, half):
			ans.append(j * 2 - 1)
		ans.append(half * 3 - 1)
		print(*ans)


import sys
import collections
import threading

def main():
	n = int(input()) // 2
	if n % 2 > 0:
		print('NO')
		return
	print('YES')
	for i in range(n - 1):
		print(i * 2 + 2, end=' ')
	print(n * 3, end=' ')
	for i in range(n):
		print(i * 2 + 3, end=' ')
	print()
input = sys.stdin.readline
tnum = int(input())
for _ in range(tnum):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		print(*list(range(2, n + 1, 2)), *list(range(1, n - 1, 2)), n - 1 + n // 2)


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		e = []
		o = []
		ee = 2
		oo = 1
		for i in range(n // 2):
			e.append(ee)
			ee += 2
		for i in range(n // 2 - 1):
			o.append(oo)
			oo += 2
		z = sum(e) - sum(o)
		o.append(z)
		print('YES')
		f = e + o
		for i in f:
			print(i, end=' ')
		print()
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		k1 = 2
		k2 = 1
		A = [0] * (n // 2)
		B = [0] * (n // 2)
		r = 0
		for j in range(n // 2 - 1):
			A[j] = k1
			B[j] = k2
			k1 += 2
			k2 += 2
			r += abs(k1 - k2)
		A[j + 1] = B[j] + 3
		r += A[j + 1]
		B[j + 1] = r
		C = A + B
		print(*C)
	else:
		print('NO')


t = int(input())
numbers = []
final = []
total_even = 0
total_odd = 0
for i in range(t):
	num = input()
	numbers.append(int(num))
for j in numbers:
	final_string = ''
	odd = 1
	if j == 2:
		print('NO')
	else:
		for i in range(1, j // 2 + 1):
			final.append(i * 2)
			total_even += i * 2
		for i in range(1, j // 2 + 1):
			if i == 1:
				final.append(odd)
				total_odd += odd
			elif i == j // 2:
				if (total_even - total_odd) % 2 == 1:
					final.append(total_even - total_odd)
					print('YES')
					for f in final:
						final_string += str(f)
						final_string += ' '
					print(final_string)
				else:
					print('NO')
			else:
				odd += 2
				final.append(odd)
				total_odd += odd
		final = []
		total_even = 0
		total_odd = 0


t = int(input())
for _ in range(t):
	n = int(input())
	even = []
	for i in range(2, 2 * (n // 2) + 1, 2):
		even.append(i)
	odd = []
	for i in range(1, 2 * (n // 2) - 1, 2):
		odd.append(i)
	last_val = sum(even) - sum(odd)
	if last_val % 2 != 0:
		print('YES')
		odd.append(last_val)
		print(*even + odd)
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	if int(x / 2) % 2 == 1:
		print('No')
	else:
		res1 = [(y + 1) * 2 for y in range(int(x / 2))]
		res2 = [(y + 1) * 2 - 1 for y in range(int(x / 2) - 1)]
		print('Yes')
		for j in res1 + res2 + [sum(res1) - sum(res2)]:
			print(j, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	elif n // 2 & 1 == 1:
		print('NO')
	else:
		print('YES')
		p = 2
		q = 1
		l = list()
		for i in range(n // 2):
			l.append(p)
			p += 2
		su = sum(l)
		for i in range(n // 2 - 1):
			l.append(q)
			q += 2
		l.append(su - sum(l[n // 2:]))
		print(*l)


for i in range(int(input())):
	x = int(input())
	if x % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		z = [a for a in range(2, x + 1) if a % 2 == 0]
		answer = []
		for i in range(x // 2 - 1):
			answer.append(z[i] - 1)
		answer.append(sum(z) - sum(answer))
		answer = z + answer
		print(' '.join(map(str, answer)))


t = int(input())
for p in range(0, t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	zerocnt = [0] * (2 * k + 1)
	onecnt = [0] * (2 * k + 2)
	for i in range(0, n // 2):
		zerocnt[a[i] + a[n - (i + 1)]] += 1
		chota = min(a[i], a[n - (i + 1)])
		bada = max(a[i], a[n - (i + 1)])
		onecnt[chota + 1] += 1
		onecnt[bada + k + 1] -= 1
	for i in range(1, 2 * k + 1):
		onecnt[i] += onecnt[i - 1]
	m = 10 ** 9
	for i in range(2, 2 * k + 1):
		if onecnt[i] - zerocnt[i] + (n // 2 - onecnt[i]) * 2 < m:
			m = onecnt[i] - zerocnt[i] + (n // 2 - onecnt[i]) * 2
	print(m)


n = int(input())
for i in range(0, n):
	o = int(input())
	A = o // 2
	if A % 2 != 0:
		print('NO')
	else:
		A = 2
		S = 0
		D = 0
		L = []
		Q = []
		G = 0
		F = 1
		for i in range(0, o // 2):
			if i == 0:
				L.append(A)
			else:
				L.append(A)
			D += A
			A += 2
		for i in range(o // 2, o):
			if i != o - 1:
				Q.append(F)
			else:
				V = D - S
				if V % 2 == 0:
					G = 1
					break
				else:
					Q.append(V)
			S += F
			F += 2
		if G == 1:
			print('NO')
		else:
			print('YES')
			print(*L, end=' ')
			print(*Q)


import math
testcases = int(input())
for i in range(testcases):
	n = int(input())
	arr = []
	first_half = 0
	second_half = 0
	if n % 4 == 0:
		for i in range(1, n // 2 + 1):
			arr.append(2 * i)
			first_half += 2 * i
		for i in range(1, n // 2):
			arr.append(2 * i - 1)
			second_half += 2 * i - 1
		arr.append(first_half - second_half)
		print('YES')
		print(*arr)
	else:
		print('NO')


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 i in range(t):
	n = II()
	if n % 4 == 0:
		yes()
		a = []
		b = []
		temp = 2
		for i in range(n // 2):
			a.append(temp)
			if i < n // 4:
				b.append(temp - 1)
			else:
				b.append(temp + 1)
			temp += 2
		print(*a + b)
	else:
		no()


t = int(input())
answers = [[0] for i in range(t)]
tasks = []
for i in range(t):
	tasks.append(int(input()))
for j in range(t):
	if tasks[j] // 2 % 2 == 1:
		answers[j].append(0)
		continue
	else:
		n = tasks[j]
		answers[j] = [1]
		a = [2 * i for i in range(1, n // 2 + 1)]
		b = [2 * i + 1 for i in range(n // 2 + n // 4)]
		answers[j].append(a + b[0:n // 2 - 1] + b[-1:])
for k in range(t):
	if answers[k][0] == 0:
		print('NO')
	else:
		print('YES')
		answers[k][1] = [str(i) for i in answers[k][1]]
		print(' '.join(answers[k][1]))


t = int(input())
for s in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		e = 2
		for i in range(n // 2):
			print(e, end=' ')
			if i % 2 == 0:
				e += 4
			else:
				e += 2
		o = 3
		for i in range(n // 2):
			print(o, end=' ')
			if i % 2 == 0:
				o += 2
			else:
				o += 4
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for i in range(4, 4 * (n // 2) + 4, 4):
			print(i, end=' ')
		for i in range(3, 8 * (n // 4), 8):
			print(i, end=' ')
		for i in range(9, 8 * (n // 4) + 9, 8):
			print(i, end=' ')
		print()
	else:
		print('NO')


T = int(input())
for i in range(0, T):
	N = int(input())
	if N % 4 != 0:
		print('NO')
	else:
		N = int(N / 2)
		print('YES')
		A = []
		B = []
		ans = []
		for j in range(1, N):
			A.append(2 * j)
			B.append(2 * j - 1)
		A.append(2 * N)
		B.append(2 * N + N - 1)
		for j in range(0, N):
			ans.append(A[j])
		for j in range(0, N):
			ans.append(B[j])
		print(*ans, sep=' ')


from math import log2
t = int(input())
for _ in range(t):
	n = int(input())
	half = n // 2
	if half & 1:
		print('NO')
		continue
	even = []
	odd = []
	for i in range(1, half + 1):
		even.append(2 * i)
	for i in range(1, n - 1, 2):
		odd.append(i)
	odd.append(sum(even) - sum(odd))
	print('YES')
	print(*even + odd, sep=' ', end='\n')


for _ in range(int(input())):
	n = int(input())
	arr = [0] * n
	isTrue = ''
	if n // 2 % 2 == 1:
		isTrue = 'NO'
	else:
		isTrue = 'YES'
	if isTrue == 'YES':
		for i in range(n // 2):
			arr[i] = 2 * (i + 1)
		for j in range(n // 4):
			arr[n // 2 + j] = arr[j] - 1
		for j in range(n // 4):
			arr[3 * (n // 4) + j] = arr[n // 4 + j] + 1
		for i in range(n):
			arr[i] = str(arr[i])
		print(isTrue)
		print(' '.join(arr))
	elif isTrue == 'NO':
		print('NO')


for f in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	nh = n // 2
	su = [0] * (2 * k + 1)
	mi = [0] * nh
	ma = [0] * nh
	for i in range(nh):
		su[a[i] + a[-i - 1]] += 1
		mi[i] = min(a[i], a[-i - 1]) + 1
		ma[i] = max(a[i], a[-i - 1]) + k
	mi.sort()
	ma.sort()
	mii = 0
	maa = 0
	sol = n
	for i in range(2 * k + 1):
		while mii < nh and mi[mii] <= i:
			mii += 1
		while maa < nh and ma[maa] < i:
			maa += 1
		sol = min(sol, n - su[i] - mii + maa)
	print(sol)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list()
	sum1 = 0
	sum2 = 0
	for i in range(n // 2):
		list1.append(2 * (i + 1))
		sum1 += 2 * (i + 1)
	p = n // 2
	if n // 2 % 2 == 0:
		print('YES')
		p = 0
		for i in range(n // 2 - 1):
			list1.append(2 * i + 1)
			p = i
		list1.append(2 * (p + 1) + 1 + n // 2)
		for i in range(len(list1)):
			print(list1[i], end=' ')
		print()
	else:
		print('NO')
	t -= 1


def solve(n, k, a):
	maxv = {i: 0 for i in range(2, 2 * k + 1)}
	minv = {i: 0 for i in range(2, 2 * k + 1)}
	exactv = {i: 0 for i in range(2, 2 * k + 1)}
	for i in range(n // 2):
		(x, y) = (a[i], a[-1 - i])
		(x, y) = (min(x, y), max(x, y))
		exactv[x + y] += 1
		minv[x + 1] += 1
		maxv[y + k] += 1
	rs = 0
	for i in range(2, 2 * k + 1):
		rs += minv[i]
		minv[i] = rs
	rs = 0
	for i in range(2 * k, 1, -1):
		rs += maxv[i]
		maxv[i] = rs
	return min([n // 2 - minv[i] + (n // 2 - maxv[i]) + (n // 2 - exactv[i]) for i in range(2, 2 * k + 1)])
t = int(input().strip())
for _ in range(t):
	(n, k) = list(map(int, input().strip().split()))
	a = list(map(int, input().strip().split()))
	print(solve(n, k, a))


def main():
	size = int(input())
	nums = [int(input()) for i in range(size)]
	for i in range(size):
		if nums[i] % 4 == 0:
			print('YES')
			evens = [x for x in range(0, nums[i] + 1) if x % 2 == 0 and x != 0]
			odds = [x for x in range(0, nums[i]) if x % 2 != 0]
			odds[-1] += len(evens)
			print(' '.join((str(x) for x in evens + odds)))
		else:
			print('NO')
main()


n = int(input())
for i1 in range(n):
	a1 = int(input())
	if a1 % 4 == 0:
		print('YES')
		li = []
		for i2 in range(int(a1 / 2)):
			li.append(2 * (1 + i2))
		for i3 in range(int(a1 / 4)):
			li.append(li[i3] - 1)
		for i4 in range(int(a1 / 4)):
			li.append(li[i4 + int(a1 / 4)] + 1)
		print(' '.join(map(str, li)))
	else:
		print('NO')


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


from sys import stdin
input = stdin.readline

def A():
	li = []
	for i in range(2, 30):
		li.append(2 ** i - 1)
	for _ in range(int(input())):
		n = int(input())
		j = 0
		while j < len(li):
			if n % li[j] == 0:
				print(n // li[j])
				break
			j += 1
	return

def B():
	for _ in range(int(input())):
		n = int(input())
		if n // 2 % 2 == 1:
			print('NO')
		else:
			print('YES')
			arr = [0] * n
			for i in range(1, n // 2 + 1):
				arr[i - 1] = 2 * i
			for i in range(n // 2, n - 1):
				arr[i] = 2 * (i - n // 2) + 1
			arr[n - 1] = sum(arr[:n // 2]) - sum(arr[n // 2:])
			print(*arr)
	return

def C():
	return

def D():
	return

def E():
	return
B()


for i in range(int(input())):
	n = int(input())
	a = []
	ans = 0
	if n // 2 % 2 != 0:
		print('NO')
	else:
		for i in range(1, n + 1):
			if i % 2 == 0:
				a.append(i)
				ans += i
		for i in range(1, n - 1):
			if i % 2 != 0:
				a.append(i)
				ans -= i
		a.append(ans)
		print('YES')
		print(*a)


from collections import deque
from collections import OrderedDict
import math
for i in range(int(input())):
	value = int(input())
	if value % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
	sumEven = 0
	sumOdd = 0
	two = 0
	one = 0
	for j in range(1, value + 1):
		if j <= value / 2:
			two += 2
			sumEven += two
			print(two, end=' ')
		elif j != value:
			if one == 0:
				one = 1
			else:
				one += 2
			sumOdd += one
			print(one, end=' ')
		else:
			print(sumEven - sumOdd)


t = int(input())
cnt = 0
while cnt < t:
	a = []
	cnt += 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(2, n // 2 + 2, 2):
			a.append(i)
			a.append(n + 2 - i)
		for j in range(1, n // 2 + 1, 2):
			a.append(j)
			a.append(n + 2 - j)
		print(' '.join((str(i) for i in a)))


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(n):
	ans = [0] * n
	if n % 4 != 0:
		print('NO')
	else:
		ii = 1
		s = 0
		for i in range(n // 2):
			ans[i] = 2 * ii
			ii += 1
			s += ans[i]
		ii = 1
		ss = 0
		for i in range(n // 2, n - 1):
			ans[i] = ii
			ii += 2
			ss += ans[i]
		ans[-1] = s - ss
		print('YES')
		print(*ans)
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	solve(N)


from sys import stdin
import math
from bisect import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()

def cost(x):
	c = 0
	for i in range(n // 2):
		if a[i] + a[n - 1 - i] == x:
			continue
		elif min(a[i], a[n - 1 - i]) >= x or max(a[i], a[n - 1 - i]) + k < x:
			c += 2
		else:
			c += 1
	return c
for _ in range(t):
	(n,) = gil()
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		a = list(range(1, n + 1))
		e = n // 4 * (2 + a[-1])
		o = n * (n + 1) // 2 - e
		a[-2] += e - o
		for i in range(1, n, 2):
			print(a[i], end=' ')
		for i in range(0, n, 2):
			print(a[i], end=' ')
		print()


t = int(input(' '))
for i in range(0, t):
	n = int(input(' '))
	L = []
	i = 0
	x = 2
	y = 1
	if n % 4 != 0 and n % 2 == 0:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		while i < n / 2:
			L.append(x)
			i += 1
			x += 2
		p = sum(L)
		while n - 1 > i >= n / 2:
			L.append(y)
			i += 1
			y += 2
		q = sum(L) - p
		L.append(p - q)
		print(*L)


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, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, k) = ria()
		a = ria()
		a1 = a[:n // 2]
		a2 = a[n // 2:][::-1]
		z = []
		pref = [0] * (2 * k + 5)
		for i in range(n // 2):
			z.append([min(a1[i], a2[i]), max(a1[i], a2[i])])
		for i in z:
			(l, r) = i
			L = 2
			R = 1 + l - 1
			if R >= L:
				pref[L] += 2
				pref[R + 1] -= 2
			L = 1 + l
			R = l + r - 1
			if R >= L:
				pref[L] += 1
				pref[R + 1] -= 1
			L = l + r + 1
			R = r + k
			if R >= L:
				pref[L] += 1
				pref[R + 1] -= 1
			L = r + k + 1
			R = 2 * k
			if R >= L:
				pref[L] += 2
				pref[R + 1] -= 2
		for i in range(1, len(pref)):
			pref[i] += pref[i - 1]
		ans = 999999999999999999
		for i in range(2, 2 * k + 1):
			ans = min(ans, pref[i])
		print(ans)
	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()


t = int(input())
while t != 0:
	a = int(input())
	sum1 = sum2 = 0
	b = 2
	c = 1
	print('YNEOS'[a % 4 == 2::2])
	if a % 4 == 0:
		for i in range(a // 2):
			print(b, end=' ')
			sum1 += b
			b += 2
		for i in range(a // 2 - 1):
			print(c, end=' ')
			sum2 += c
			c += 2
		print(sum1 - sum2)
	t -= 1


t = int(input())
for i in range(t):
	a = []
	n = int(input())
	c = n // 2
	if c % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = 1
		s = 0
		se = 0
		so = 0
		while k <= c:
			a.append(str(k * 2))
			se += k * 2
			k += 1
		b = 1
		i = 1
		while i < c:
			a.append(str(b))
			so += b
			b += 2
			i += 1
		a.append(str(se - so))
		st = ' '.join(a)
		print(st)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		array = [0] * n
		term = 2
		for index in range(n // 2):
			array[index] = term
			array[index + n // 2] = term - 1
			term += 2
		array[len(array) - 1] = array[n // 2 - 1] + n // 2 - 1
		print('YES')
		print(' '.join([str(element) for element in array]))


import sys
import math

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 % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		count = 0
		for i in range(2, n + 1, 2):
			a.append(i)
			k = i
		for j in range(1, n - 2, 2):
			a.append(j)
			count = count + 1
		l = k + count
		a.append(l)
		print(*a)


from sys import stdin
input = stdin.buffer.readline
t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	n = n // 2
	even = []
	odd = []
	x = 2
	y = 4
	for i in range(n // 2):
		even.append(x)
		even.append(y)
		odd.append(x - 1)
		odd.append(y + 1)
		x = y + 4
		y = x + 2
	print('YES')
	print(*even + odd)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		half = n // 2
		if half % 2:
			print('NO')
		else:
			forward = [2 * i for i in range(1, half + 1)]
			back = [2 * i - 1 for i in range(1, half)]
			back.append(2 * half + half - 1)
			ans = forward + back
			print('YES')
			print(*ans)
main()


def main(a):
	if a / 2 % 2 != 0:
		return ['NO']
	else:
		index = 2
		z = []
		while index <= a:
			z.append(index)
			index = index + 2
		i = int(a / 2) - 1
		index = 1
		while index < a - 2:
			z.append(index)
			index = index + 2
		z.append(z[i] + i)
		return ['YES', z]
t = int(input())
for t_itr in range(t):
	n = int(input())
	res = main(n)
	if len(res) == 1:
		print(res[0])
	else:
		print(res[0])
		print(*res[1])


t = int(input())
data = []
for i in range(t):
	data.append(int(input()))
for a in data:
	d = (a + 2) / 2
	if d % 2 == 0:
		print('NO')
	else:
		result_even = []
		result_odd = []
		for i in range(a + 2):
			if i == d or i == 0:
				continue
			if i % 2 == 0:
				result_even.append(i)
			else:
				result_odd.append(i)
		result_even.extend(result_odd)
		print('YES')
		for n in result_even:
			print(n, end=' ')
		print()


def main(n):
	if n // 2 % 2 == 1:
		return 'NO'
	else:
		valid = 'YES\n'
		(l_half, r_half) = ([], [])
		(l_sum, r_sum) = (0, 0)
		for i in range(2, n + 1, 2):
			l_half.append(str(i))
			l_sum += i
		for j in range(1, n - 2, 2):
			r_half.append(str(j))
			r_sum += j
		r_half.append(str(l_sum - r_sum))
		return valid + ' '.join(l_half + r_half)
t = int(input())
cases = []
for i in range(t):
	cases.append(int(input()))
for case in cases:
	print(main(case))


import sys
from collections import defaultdict as dd
import math

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

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	n = int(data())
	(e, d) = ([], [])
	(a, b, k) = (0, 1, 0)
	for i in range(n // 2):
		a += 2
		e.append(a)
	c = sum(e)
	for i in range(n // 2):
		if i == n // 2 - 1:
			if c % 2 == 0:
				k = 1
				break
			else:
				d.append(c)
		else:
			c -= b
			d.append(b)
			b += 2
	if k == 0:
		print('YES')
		print(*e, end=' ')
		print(*d)
	else:
		print('NO')


n_tests = int(input())
for _ in range(n_tests):
	n = int(input())
	half = n // 2
	if half % 2 == 0:
		print('YES')
		for i in range(1, half + 1):
			print(i * 2, end=' ')
		for i in range(1, half):
			print(i * 2 - 1, end=' ')
		last_odd = half * (half + 1) - i ** 2
		print(last_odd)
	else:
		print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

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

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

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		if n % 4 != 0:
			print('NO')
		else:
			flag = 1
			arr = []
			sm = 0
			for i in range(1, n // 2 + 1):
				arr.append(2 * i)
				sm += 2 * i
			for i in range(n // 2 - 1):
				arr.append(2 * (i + 1) - 1)
				sm -= 2 * (i + 1) - 1
				if sm <= 0:
					flag = 0
					break
			arr.append(sm)
			if flag:
				print('YES')
				for i in arr:
					print(i, end=' ')
				print()
			else:
				print('NO')
main()


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	arr = [2 * i for i in range(1, int(n / 2) + 1)]
	ar = [i - 1 for i in arr]
	ar[-1] += int(n / 2)
	print(' '.join([str(i) for i in arr + ar]))
for _ in range(int(input())):
	solve()


for t in range(0, int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		l1 = []
		l2 = []
		sum = 0
		sum2 = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				sum += i
				l1.append(i)
		j = 1
		while len(l2) < n // 2 - 1:
			if j % 2 == 0:
				continue
			else:
				sum2 += j
				l2.append(j)
			j += 2
		l2.append(sum - sum2)
		print('YES')
		l3 = l1 + l2
		print(' '.join(map(str, l3)))


def getArray(a):
	if a % 4 == 1 or a % 4 == 3 or a % 4 == 2:
		print('NO')
	else:
		print('YES')
		arr = [0] * a
		j = k = 0
		while j < a // 2:
			arr[j] = 2 + k
			print(arr[j], end=' ')
			k += 4
			j += 1
		k = -1
		m = 0
		l = 0
		while j < a and l < a // 2:
			arr[j] = arr[l] - k ** m
			print(arr[j], end=' ')
			m += 1
			l += 1
		print()
t = int(input())
for i in range(t):
	n = int(input())
	getArray(n)


t = int(input())
q = []
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		q.append(['NO'])
	else:
		q.append(['YES'])
		a = []
		for j in range(2, n + 1, 2):
			a.append(j)
		b = sum(a)
		c = 0
		for j in range(1, n - 1, 2):
			a.append(j)
			c += j
		a.append(b - c)
		q.append(a)
for i in q:
	for j in i:
		print(j, end=' ')
	print()


t = int(input())
for loop in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		r = []
		for i in range(1, n + 2):
			if i == (n + 2) // 2:
				pass
			elif i % 2 == 0:
				l.append(i)
			else:
				r.append(i)
		print(*l, *r)


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


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		l = list(range(1, n + 2))
		even = []
		odd = []
		for i in range(0, n + 1):
			if i == n // 2:
				pass
			elif i % 2 == 0:
				odd.append(l[i])
			else:
				even.append(l[i])
		f = even + odd
		print('YES')
		for i in range(len(f)):
			print(f[i], end=' ')
		print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	freq = {i: 0 for i in range(2, 2 * k + 1)}
	pref = [0] * (2 * k + 10)
	for i in range(n // 2):
		(l, r) = (min(a[i], a[n - 1 - i]), max(a[i], a[n - 1 - i]))
		freq[l + r] += 1
		pref[l + 1] += 1
		pref[r + k + 1] -= 1
	ans = n
	for i in range(2, 2 * k + 1):
		pref[i] += pref[i - 1]
		ans = min(ans, pref[i] - freq[i] + 2 * (n // 2 - pref[i]))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	even = list(range(2, int(2 * n / 2) + 1, 2))
	odd = list(range(1, int(2 * n / 2) + 1, 2))
	if n not in range(2, n + 1, 4):
		diff = odd[-1] + sum(even) - sum(odd)
		print('YES')
		print(' '.join(map(str, even + odd[:-1])), diff)
	else:
		print('NO')


t = int(input())

def f(n):
	if n / 2 % 2 == 0:
		print('YES')
		for i in range(2, n + 1, 2):
			(print(i),)
		for i in range(1, n - 1, 2):
			(print(i),)
		print(int(n - 1 + n / 2))
	else:
		print('NO')
for i in range(t):
	n = int(input())
	f(n)


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4:
		print('NO\n')
	else:
		print('YES\n')
		s = 0
		for i in range(n // 2):
			print(str(2 * (i + 1)) + ' ')
			s += 2 * (i + 1)
		for i in range(n // 2 - 1):
			print(str(2 * i + 1) + ' ')
			s -= 2 * i + 1
		print(str(s) + '\n')


for t in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = 2
		b = 1
		while a <= n:
			print(a, end=' ')
			a += 2
		while b < n - 1:
			print(b, end=' ')
			b += 2
		print(3 * n // 2 - 1)
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	val = int(input())
	if val % 4 != 0:
		print('NO')
	else:
		print('YES')
		sume = val / 2 * (2 * (val / 2) + 2)
		sumo = val / 2 * (2 * (val / 2))
		extra = sume - sumo
		for i in range(1, val // 2 + 1):
			print('{} '.format(i * 2), end='')
		for i in range(1, val // 2):
			print('{} '.format(i * 2 - 1), end='')
		print(i + int(extra))


from sys import stdin, stdout
from sys import maxsize

def solve(n):
	a = [0] * (n + 1)
	for i in range(1, n // 2 + 1):
		a[i] = 2 * i
	for i in range(n // 2 + 1, 3 * n // 4 + 1):
		a[i] = a[i - n // 2] - 1
	for i in range(3 * n // 4 + 1, n + 1):
		a[i] = a[i - n // 2] + 1
	for i in range(1, n + 1):
		print(a[i], end=' ')
	pass
test = 1
test = int(input())
for t in range(0, test):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = solve(n)
		print()


for _ in range(int(input())):
	n = int(input())
	print('NO' if n % 4 else 'YES')
	if not n % 4:
		print(*map(str, [10 * i + x for x in [2, 4, 1, 5] for i in range(n // 4)]))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1 or n // 2 % 2 == 1:
		print('NO')
		continue
	else:
		o = [1]
		e = [2]
		for i in range(2, n // 2 + 1):
			if i % 2 == 1:
				o.append(o[-1] + 2)
				e.append(e[-1] + 4)
			else:
				o.append(o[-1] + 4)
				e.append(e[-1] + 2)
		print('YES')
		print(*e, end=' ')
		print(*o)


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 input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	(n, k) = rinput()
	a = rlinput()
	arr = [0] * (2 * k + 10)
	for i in range(n // 2):
		val1 = min(a[i], a[n - i - 1])
		val2 = max(a[i], a[n - i - 1])
		arr[val1 + 1] += 1
		arr[val2 + k + 1] -= 1
		arr[val1 + val2] += 1
		arr[val1 + val2 + 1] -= 1
	arr = list(accumulate(arr))
	print(n - max(arr))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	a1 = []
	a2 = []
	curx = 3
	for i in range(n // 4):
		a1.append(curx - 2)
		a1.append(curx + 2)
		a2.append(curx + 1)
		a2.append(curx - 1)
		curx += 6
	print('YES')
	print(*a2 + a1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	lst = [0] * (2 * k + 2)
	interval = []
	for i in range(n // 2):
		st = min(a[i], a[n - 1 - i])
		s = a[i] + a[n - 1 - i]
		end = s - st + k
		lst[st + 1] += 1
		lst[end + 1] -= 1
		lst[s] += 1
		lst[s + 1] -= 1
	cur = 0
	idx = 0
	interval = [0, 0]
	maxy = -1
	for i in range(2 * k + 1):
		cur += lst[i]
		if maxy < cur:
			maxy = cur
			idx = i
			interval[0] = i
		if lst[i] < 0:
			interval[1] = i - 1
	res = idx
	ans = 0
	for i in range(n // 2):
		st = min(a[i], a[n - 1 - i])
		s = a[i] + a[n - 1 - i]
		end = s - st + k
		if res == s:
			continue
		elif st + 1 <= res <= end:
			ans += 1
		else:
			ans += 2
	print(ans)


q = int(input())
while q > 0:
	q -= 1
	x = int(input())
	if x % 4 == 0:
		print('YES')
		res = 0
		for i in range(0, x // 2):
			res += 2 * i + 2
			print(2 * i + 2, end=' ')
		for i in range(x // 2, x - 1):
			res -= (i - x // 2) * 2 + 1
			print((i - x // 2) * 2 + 1, end=' ')
		print(res)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	res = []
	esum = 0
	osum = 0
	r = ''
	if n % 4 == 0:
		print('YES')
		for j in range(1, int(n / 2) + 1):
			res.append(2 * j)
			esum = esum + 2 * j
		for k in range(1, n):
			if len(res) != n - 1:
				if k % 2 != 0:
					res.append(k)
					osum = osum + k
		res.append(esum - osum)
		r = ' '.join((str(e) for e in res))
		print(r)
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline

def solve(n):
	if n // 2 & 1:
		return []
	arr = [0] * n
	even = 0
	odd = n // 2
	for i in range(1, n + 1):
		if i & 1:
			arr[odd] = i
			odd += 1
		else:
			arr[even] = i
			even += 1
	arr[-1] += n // 2
	return arr
t = int(input())
for _ in range(t):
	n = int(input())
	ans = solve(n)
	if not ans:
		print('NO')
	else:
		print('YES')
		fans = ' '.join(map(str, ans))
		print(fans)


from collections import *
from math import *

def I():
	return map(int, input().strip().split())
for Q in range(int(input())):
	n = int(input())
	if bool(n // 2 % 2):
		print('NO')
	else:
		print('YES')
		(s1, s2) = (0, 0)
		for i in range(2, n + 1, 2):
			s1 += i
			print(i, end=' ')
		for i in range(1, n - 2, 2):
			s2 += i
			print(i, end=' ')
		print(-s2 + s1)


def isBalanced(num):
	num = int(num)
	if num == 2:
		print('NO')
		return
	if num // 2 % 2 != 0:
		print('NO')
		return
	else:
		print('YES')
		odd = 1
		remember = 0
		for i in range(1, num // 2 + 1):
			print(i * 2, end=' ')
		for i in range(num // 2 + 1, num):
			print(odd, end=' ')
			odd += 2
		remember = num + num // 2 - 1
		print(remember)
n = int(input())
for i in range(n):
	temp = int(input())
	isBalanced(temp)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ev = []
		od = []
		for j in range(n // 2):
			ev.append(2 * (j + 1))
			if j < n // 4:
				od.append(2 * (j + 1) - 1)
			else:
				od.append(2 * (j + 1) + 1)
		for el in ev + od:
			print(el, end=' ')
		print()


for _ in range(int(input())):
	q = int(input())
	s = []
	f = []
	if q % 4 == 0:
		print('YES')
		for i in range(2, q + 1, 2):
			s.append(i)
		for i in range(len(s) // 2):
			f.append(s[i] - 1)
		for i in range(len(s) // 2, len(s)):
			f.append(s[i] + 1)
		print(*s + f)
	else:
		print('NO')


def task(n):
	if n % 4 != 0:
		print('NO')
		return
	a = [0] * n
	half = int(n / 2)
	chunks = int(n / 4)
	for i in range(0, chunks):
		a[i * 2] = i * 6 + 2
		a[i * 2 + 1] = i * 6 + 4
		a[half + i * 2] = i * 6 + 1
		a[half + i * 2 + 1] = i * 6 + 5
	print('YES')
	print(' '.join(map(str, a)))
t = int(input())
for i in range(0, t):
	n = int(input())
	task(n)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(rev):
		(n, k) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		imos = [0] * (2 * k + 2)
		for i in range(n // 2):
			s = a[i]
			t = a[n - 1 - i]
			(s, t) = (min(s, t), max(s, t))
			l = s + 1
			m = s + t
			r = t + k
			imos[l] -= 1
			imos[m] -= 1
			imos[m + 1] += 1
			imos[r + 1] += 1
			imos[1] += 2
		for i in range(1, 2 * k + 2):
			imos[i] += imos[i - 1]
		ans = 10 ** 18
		for i in range(1, 2 * k + 1):
			ans = min(ans, imos[i])
		yield ans
rev = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
for i in range(t):
	n = int(input())
	flag = 0
	l1 = []
	l2 = []
	f = 2
	for j in range(n // 2):
		l1.append(f)
		f = f + 2
	s = sum(l1)
	tt = 0
	f = 1
	for j in range(n // 2 - 1):
		l2.append(f)
		s -= f
		f = f + 2
	if s % 2 == 0:
		print('NO')
	else:
		print('YES')
		for j in l1:
			print(j, end=' ')
		for j in l2:
			print(j, end=' ')
		print(s)


judge = True
if judge:
	from sys import stdin, stdout
else:
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')
stdin.readline()
x = list(map(int, stdin.readlines()))
for v in x:
	k = v // 2
	stdout.write(['YES\n', 'NO\n'][k % 2])
	if k % 2:
		continue
	s = 0
	n = 2
	for i in range(k):
		stdout.write(str(n) + ' ')
		s += n
		n += 2
	n = 1
	for i in range(k - 1):
		stdout.write(str(n) + ' ')
		s -= n
		n += 2
	stdout.write(str(s) + '\n')
stdin.close()
stdout.close()


t = int(input())
a = [0] * 3 * 10 ** 5
for _ in range(t):
	n = int(input())
	if n % 4:
		print('NO')
		continue
	print('Yes')
	for i in range(2, n + 1, 2):
		print(i)
	for i in range(1, n - 1, 2):
		print(i)
	print(n - 1 + int(n / 2))


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		k = int(n / 2)
		s = [0] * n
		for j in range(0, k):
			s[j] = 2 * (j + 1)
			if j != k - 1:
				s[k + j] = 2 * j + 1
			else:
				s[k + j] = 3 * k - 1
		print('YES')
		for l in range(0, n):
			print(s[l], end=' ')


t = input()
t = int(t)
arr = []
for i in range(t):
	n = input()
	n = int(n)
	n = int(n / 2)
	arr.clear()
	if n % 2 == 0:
		print('YES')
		for j in range(n):
			arr.append(4 * j + 1)
		for j in range(n):
			if j % 2 == 0:
				print(arr[j] + 1, end=' ')
			else:
				print(arr[j] - 1, end=' ')
		for j in range(n):
			print(arr[j], end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		left = [2 * i for i in range(1, n // 2 + 1)]
		right = [left[i] - 1 if i < n // 4 else left[i] + 1 for i in range(n // 2)]
		print('YES')
		print(' '.join(list(map(str, left))) + ' ' + ' '.join(list(map(str, right))))


t = int(input())
import math
while t:
	t = t - 1
	n = int(input())
	n = n // 2
	if n % 2 == 0:
		lst = []
		i = 2
		s = 0
		m = n
		while n:
			n = n - 1
			s = s + i
			lst.append(i)
			i = i + 2
		i = 1
		while m:
			if m == 1:
				lst.append(s)
			s = s - i
			if m != 1:
				lst.append(i)
			i = i + 2
			m = m - 1
	else:
		print('NO')
		continue
	print('YES')
	for i in lst:
		print(i, end=' ')
	print()


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 powermod(a, b):
	if a == 0:
		return 0
	a %= mod
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % mod
		a *= a
		a %= mod
		b = b >> 1
	return res

def main():
	for _ in range(ii()):
		(n, k) = mi()
		a = li()
		ans = [0] * (2 * k + 5)
		tot = [0] * (2 * k + 5)
		for i in range(n // 2):
			x = max(a[i], a[n - i - 1])
			y = min(a[i], a[n - i - 1])
			ans[2] += 2
			ans[y + 1] -= 1
			ans[x + k + 1] += 1
			s = a[i] + a[n - i - 1]
			tot[s] += 1
		for i in range(1, 2 * k + 1):
			ans[i] += ans[i - 1]
		for i in range(2, 2 * k + 1):
			ans[i] -= tot[i]
		print(min(ans[2:2 * k + 1]))
main()


t = int(input())
for i in range(t):
	s = int(input())
	a = s / 2
	if a % 2 != 0:
		print('NO')
	else:
		d = []
		total = 0
		for j in range(2, s + 1, 2):
			d.append(j)
			total += j
		odd = [1]
		total1 = 1
		k = 1
		while total1 < total:
			k += 2
			total1 += k
			odd.append(k)
		f = total1 - total
		if f > 0:
			if f in odd:
				odd.remove(f)
			else:
				pass
		else:
			pass
		print('YES')
		print(*d + odd)


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	else:
		l = []
		r = []
		for i in range(2, n + 1, 2):
			l.append(i)
			if i == n:
				r.append(i + len(l) - 1)
				break
			r.append(i - 1)
		e = l + r
		print('Yes')
		for q in e:
			print(q, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for j in range(n // 2):
			a.append(2 * (j + 1))
		b = []
		for j in range(n // 2 - 1):
			b.append(2 * j + 1)
		sum1 = sum(a)
		sum2 = sum(b)
		diff = sum1 - sum2
		b.append(diff)
		a.extend(b)
		print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		even = [2 * i + 2 for i in range(n // 2)]
		odd1 = map(lambda x: x - 1, even[:n // 4])
		odd2 = map(lambda x: x + 1, even[n // 4:])
		print(*even, *odd1, *odd2)
	else:
		print('NO')


import sys
input = sys.stdin.readline
from itertools import accumulate
t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	ANS = [0] * (k * 2 + 3)
	for i in range(n // 2):
		(x, y) = (A[i], A[n - 1 - i])
		if x > y:
			(x, y) = (y, x)
		ANS[x + 1] -= 1
		ANS[y + k + 1] += 1
		ANS[x + y] -= 1
		ANS[x + y + 1] += 1
	total = 0
	best = float('inf')
	for v in ANS:
		total += v
		best = min(best, total)
	print(n + best)


for _ in range(int(input())):
	c = 1
	n = int(input())
	e = n // 2
	o = e - 1
	e = e * (e + 1)
	o = o * o
	if (e - o) % 2 != 0:
		print('YES')
		c = 2
		for i in range(n // 2):
			print(c, end=' ')
			c += 2
		c = 1
		for i in range(n // 2 - 1):
			print(c, end=' ')
			c += 2
		print(e - o, end=' ')
		print()
	else:
		print('NO')


from sys import stdin

def solve():
	n = int(input())
	soe = n // 2 * (n // 2 + 1)
	soo = (n // 2) ** 2
	if (soe - soo) % 2 == 1:
		print('NO')
	else:
		print('YES')
		(e, o) = (2, 1)
		for i in range(2, 2 * (n // 2) + 2, 2):
			print(i, end=' ')
		for i in range(1, 2 * (n // 2) - 2, 2):
			print(i, end=' ')
		print(2 * (n // 2) - 1 + (soe - soo))
t = int(input())
for i in range(t):
	solve()


t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for i in range(t):
	n = a[i]
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		o = []
		for j in range(n // 2):
			o.append(2 * (j + 1))
		x = sum(o)
		for j in range(n // 2 - 1):
			o.append(2 * j + 1)
		y = sum(o) - x
		o.append(x - y)
		for num in o:
			print(num, end=' ')
		print()


import sys
t = int(sys.stdin.readline())
while t:
	n = int(sys.stdin.readline())
	z = n // 2
	if z % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		half = n // 2
		even = []
		odd = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				even.append(i)
			else:
				odd.append(i)
		odd = odd[:-1]
		z = n // 4
		odd.append(odd[-1] + 2 * (z + 1))
		print(*even + odd)
	t -= 1


t = int(input())
while t:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l1 = []
		l = 0
		(se, so) = (0, 0)
		for x in range(n // 2):
			l += 2
			l1.append(l)
			se += l
		o = 1
		for x in range(n // 2, n - 1):
			l1.append(o)
			so += o
			o += 2
		l1.append(se - so)
		print(*l1)
	t -= 1


def f(n):
	L = [0] * n
	L[0] = 2
	L[n // 2] = 1
	for i in range(1, n // 2):
		if i % 2 == 0:
			L[i] = L[i - 1] + 4
		else:
			L[i] = L[i - 1] + 2
	for j in range(n // 2 + 1, n):
		if j % 2 == 0:
			L[j] = L[j - 1] + 2
		else:
			L[j] = L[j - 1] + 4
	return L
N = int(input())
while N > 0:
	n = int(input())
	if n % 4 == 0:
		print('YES')
		A = f(n)
		for i in A:
			print(i, end=' ')
	elif n % 4 != 0:
		print('NO')
	N -= 1


import sys
input = sys.stdin.readline
Q = int(input())
Query = [int(input()) for _ in range(Q)]
for N in Query:
	if N % 4 != 0:
		print('NO')
	else:
		print('YES')
		L = N // 4
		A1 = []
		A2 = []
		for l in range(L):
			A1.append(6 * l + 1)
			A1.append(6 * l + 5)
			A2.append(6 * l + 2)
			A2.append(6 * l + 4)
		ans = A2 + A1
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, [2 * m for m in range(1, n // 2 + 1)])), ' '.join(map(str, [2 * m - 1 for m in range(1, n // 2)])), n - 1 + n // 2, sep=' ')


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from collections import deque
t = int(input())
for ii in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	d = [0] * (2 * k + 2)
	for i in range(n // 2):
		a = l[i]
		b = l[n - 1 - i]
		p = min(a, b)
		q = max(a, b)
		mi = p + 1
		ma = q + k
		d[0] += 2
		d[mi - 1] -= 2
		d[mi - 1] += 1
		d[p + q - 1] -= 1
		d[p + q] += 1
		d[ma] -= 1
		d[ma] += 2
		d[-1] -= 2
	for i in range(2 * k + 1):
		d[i + 1] += d[i]
	print(min(d[:-1]))
sys.exit()
N = 5
es = [[1, 2, 3], [0, 2], [0, 1], [0, 4], [3]]
colors = [0 for i in range(N)]

def dfs(v, color):
	print(v, color)
	colors[v] = color
	for to in es[v]:
		if colors[to] == color:
			return False
		if colors[to] == 0 and (not dfs(to, -color)):
			return False
	return True

def is_bipartite():
	return dfs(0, 1)
print(is_bipartite())


import sys
from collections import Counter

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	if N // 2 % 2 != 0:
		NO()
		continue
	a = 2
	ans = [0] * N
	for i in range(N // 2):
		j = i + N // 2
		ans[i] = a
		if i % 2 == 0:
			ans[j] = a - 1
		else:
			ans[j] = a + 1
		a += 4
	YES()
	print(*ans)


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().strip().split()]
	a = [int(x) for x in input().strip().split()]
	dic = {}
	seg = [0 for i in range(2 * k + 5)]
	l = 0
	h = n - 1
	while l < h:
		s = a[h] + a[l]
		if s not in dic:
			dic[s] = 0
		dic[s] += 1
		mn = min(a[l], a[h]) + 1
		mx = max(a[l], a[h]) + k
		seg[mn] += 1
		seg[mx + 1] -= 1
		l += 1
		h -= 1
	tot = n // 2
	s = 0
	for i in range(2 * k + 5):
		s += seg[i]
		seg[i] = s
	res = n
	for i in range(2 * k + 5):
		curr = seg[i]
		if i in dic:
			onere = curr - dic[i]
			ca = dic[i]
		else:
			onere = curr
			ca = 0
		if ca >= tot:
			res = 0
			break
		else:
			currres = onere
			if onere + ca >= tot:
				res = min(res, currres)
			else:
				rem = tot - ca - onere
				currres += 2 * rem
				res = min(res, currres)
	print(res)


from sys import stdin

def solve(n):
	(x, ans, num, ac) = (0, [], 1, 0)
	for i in range(1, n // 2 + 1):
		ans.append(2 * i)
		x += 2 * i
	for i in range(1, 1 + n // 2):
		if i == n // 2:
			ans.append(x - ac)
			if (x - ac) % 2 == 0:
				return []
		else:
			ans.append(num)
			ac += num
			num += 2
	return ans if sum(ans) % 2 == 0 else []

def main():
	r = stdin.readline
	cases = int(r())
	for case in range(cases):
		n = int(r())
		ans = solve(n)
		if ans:
			print('YES')
			print(*ans)
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ans = []
		for i in range(2, n + 1, 2):
			ans.append(i)
		for i in range(1, n - 1, 2):
			ans.append(i)
		ans.append(3 * n // 2 - 1)
		print('YES')
		for x in ans:
			print(x, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = [2 * i for i in range(1, n // 2 + 1)]
		o = []
		for (index, i) in enumerate(e):
			if index < n // 4:
				o.append(i - 1)
			else:
				o.append(i + 1)
		l = e + o
		print(' '.join(list(map(str, l))))


from sys import stdin
input = stdin.readline
for t in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		i = 2
		j = n // 2
		arr1 = []
		arr2 = []
		odd = 1
		even = 2
		while j:
			if even - odd < 0:
				arr1.append(even)
				arr2.append(odd)
				even += 4
				odd = even - 1
			elif odd - even < 0:
				arr1.append(even)
				arr2.append(odd)
				odd += 4
				even = odd - 1
			j -= 1
		print('YES')
		for i in arr1:
			print(i, end=' ')
		for i in arr2:
			print(i, end=' ')
		print()


t = int(input())
import math
for xyz in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO', end=' ')
	else:
		print('YES')
		for k in range(n // 2):
			print(2 * (k + 1), end=' ')
		for kz in range(n // 2):
			if kz == n // 2 - 1:
				print(n + n // 2 - 1, end=' ')
			else:
				print(2 * (kz + 1) - 1, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		n = n // 2
		a = [i * 2 for i in range(1, n + 1)]
		b = [i * 2 - 1 for i in range(1, n + 1)]
		b[-1] += sum(a) - sum(b)
		print(' '.join(map(str, a + b)))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	arr = []
	arr.append(2)
	count_even = 2
	for i in range(1, n // 2):
		arr.append(arr[i - 1] + 2)
		count_even += arr[i]
	arr.append(1)
	count_odd = 1
	for i in range(n // 2 + 1, n - 1):
		arr.append(arr[i - 1] + 2)
		count_odd += arr[i]
	arr.append(count_even - count_odd)
	print('YES')
	print(*arr)


def bal(n):
	if n % 4 != 0:
		return 0
	l = []
	for i in range(2, n + 1, 2):
		l.append(i)
	for i in range(1, n, 2):
		if i == n - 1:
			c = i + n // 2
			l.append(c)
			return l
		l.append(i)
t = int(input())
for _ in range(t):
	n = int(input())
	l = bal(n)
	if l:
		print('YES')
		print(*l)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(1, n // 2 + 1):
			l.append(i * 2)
		l.append(1)
		for i in range(1, n // 2 - 1):
			l.append(l[-1] + 2)
		u = sum(l[:n // 2]) - sum(l[n // 2:])
		l.append(u)
		for e in l:
			print(e, end=' ')


import sys
for _ in range(int(input())):
	Map = {}
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	max_sum = [0 for i in range(2 * k + 1)]
	min_sum = [0 for i in range(2 * k + 1)]
	for i in range(n // 2):
		s = a[i] + a[n - 1 - i]
		min_sum[min(a[i], a[n - 1 - i]) + 1] += 1
		max_sum[max(a[i], a[n - 1 - i]) + k] += 1
		if s not in Map:
			Map[s] = 0
		Map[s] += 1
	for i in range(1, 2 * k + 1):
		min_sum[i] += min_sum[i - 1]
		max_sum[i] += max_sum[i - 1]
	ans = sys.maxsize
	for i in range(2, 2 * k + 1):
		two = max_sum[i - 1] + min_sum[2 * k] - min_sum[i]
		two *= 2
		res = two + (n - two) // 2
		if i in Map:
			res -= Map[i]
		ans = min(ans, res)
	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 Counter
from math import gcd
mod = 998244353

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		arr = []
		mi_ = [0] * (k + 1)
		ma_ = [0] * (k + 2)
		s = [0] * (2 * k + 1)
		for i in range(n // 2):
			arr.append((a[i], a[n - 1 - i]))
			s[a[i] + a[n - 1 - i]] += 1
			mi_[max(a[i], a[n - 1 - i])] += 1
			ma_[min(a[i], a[n - 1 - i])] += 1
		for i in range(1, len(mi_)):
			mi_[i] += mi_[i - 1]
		for i in range(len(mi_) - 2, 0, -1):
			ma_[i] += ma_[i + 1]
		ans = n
		for i in range(2, 2 * k + 1):
			temp = n // 2 + mi_[max(0, i - k - 1)] + ma_[min(i, k + 1)] - s[i]
			ans = min(ans, temp)
		print(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()


total = int(input())
for _ in range(total):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		(even_list, odd_list) = ([i for i in range(1, n + 1) if i % 2 == 0], [i for i in range(1, n + 1) if i % 2 != 0])
		if sum(even_list) != sum(odd_list):
			odd_list[-1] += n // 2
			if sum(even_list) != sum(odd_list):
				print('NO')
			else:
				print('YES')
				print(' '.join((str(x) for x in even_list)), end=' ')
				print(' '.join((str(x) for x in odd_list)))
		else:
			print('YES')
			print(' '.join((str(x) for x in even_list)), end=' ')
			print(' '.join((str(x) for x in odd_list)))


n = int(input())
for i in range(0, n):
	x = int(input())
	ar = []
	b = []
	if x % 4 == 0:
		for j in range(1, x + 2):
			if j != x / 2 + 1 and j % 2 == 0:
				ar.append(j)
			elif j != x / 2 + 1:
				b.append(j)
		print('YES')
		print(*ar + b)
	else:
		print('NO')


import math
test = int(input())
while test:
	number = int(input())
	div = int(number / 2)
	if div % 2 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		sumodd = 0
		for i in range(1, div + 1):
			print(2 * i, end=' ')
			sum += 2 * i
		for i in range(1, div):
			print(2 * i - 1, end=' ')
			sumodd += 2 * i - 1
		print(sum - sumodd)
	test -= 1


T = int(input())
for _ in range(T):
	n = int(input())
	ans = 'NO'
	a = []
	if n // 2 % 2 == 0:
		ans = 'YES'
		S = 0
		k = 2
		for i in range(0, n // 2):
			S += k
			a.append(k)
			k += 2
		k = 1
		for i in range(0, n // 2 - 1):
			S -= k
			a.append(k)
			k += 2
		a.append(S)
	print(ans)
	if ans == 'YES':
		print(*a)


def hello():
	n = int(input())
	if n % 4 != 0:
		print('NO', end='\n')
		return 0
	else:
		print('YES', end='\n')
		s1 = 0
		for i in range(n // 2 - 1):
			print(2 * i + 2, end=' ')
			s1 += 2 * i + 2
		print(10 ** 9, end=' ')
		s1 += 10 ** 9
		s2 = 0
		for i in range(n // 2 - 1):
			print(2 * i + 3, end=' ')
			s2 += 2 * i + 3
		print(abs(s1 - s2), end='\n')
a = int(input())
for i in range(a):
	hello()


t = int(input())
ls = []
for i in range(t):
	n = int(input())
	ls.append(n)
for j in range(len(ls)):
	if ls[j] / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		even = 2
		evensm = 0
		for k in range(int(ls[j] / 2)):
			print(even, end=' ')
			evensm += even
			even += 2
		odd = 1
		oddsm = 0
		for l in range(int(ls[j] / 2 - 1)):
			print(odd, end=' ')
			oddsm += odd
			odd += 2
		print(evensm - oddsm)


import sys
input = sys.stdin.readline
ans = []
t = int(input())
for _ in range(t):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('No')
		continue
	a1 = [int(2 * x) for x in range(1, n + 1)]
	a2 = [int(2 * x - 1) for x in range(1, n)]
	a2.append(sum(a1) - sum(a2))
	print('Yes')
	print(*a1 + a2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		(ev, od) = ([], [])
		for i in range(1, n // 2 + 1):
			if i % 2 == 0:
				ev.append(i)
				ev.append(n + i - 2)
			else:
				od.append(i)
				od.append(n + i)
		print('YES')
		print(' '.join((str(i) for i in ev)), end=' ')
		print(' '.join((str(i) for i in od)))


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	n = int(input())
	a = []
	if n % 4 == 0:
		e = 2
		o = 1
		for i in range(n // 2):
			a.append(e)
			e += 2
		for i in range(n // 2 - 1):
			a.append(o)
			o += 2
		o += n // 2
		a.append(o)
		print('YES')
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
	else:
		print('NO')
	t -= 1


import sys
input = sys.stdin.readline

def ini():
	return int(input())

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

def insl():
	s = input()
	return list(s[:len(s) - 1])
t = ini()
for _ in range(t):
	n = ini()
	ans = 'NO'
	if n % 4 == 0 and n > 2:
		ans = 'YES\n'
		for i in range(1, n + 1):
			if i <= n // 2:
				ans += '%d ' % (2 * i)
			elif i < n:
				ans += '%d ' % (2 * (i - n // 2) - 1)
			else:
				ans += '%d' % (n + n // 2 - 1)
	print(ans)


import os
import itertools as it

def f(n):
	k = n // 2
	if k % 2 == 1:
		return 'NO'
	nums = ' '.join(map(str, it.chain(range(2, 2 * k + 1, 2), range(1, 2 * k - 1, 2), [3 * k - 1])))
	return 'YES' + '\n' + nums

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		print(f(int(input())))
if 'paalto' in os.getcwd():
	from string_source import string_source
	s = string_source('5\n2\n4\n6\n8\n10')
	pp(s)
else:
	pp(input)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	l = [0] * (2 * k + 2)
	s = [0] * (2 * k + 2)
	coun = []
	for i in range(n // 2):
		s[a[i] + a[n - i - 1]] += 1
		b = a[i]
		c = a[n - i - 1]
		mi = min(a[i], a[n - i - 1])
		ma = max(a[i], a[n - i - 1])
		l[mi + 1] += 1
		l[ma + k + 1] -= 1
	for i in range(2, len(l)):
		l[i] += l[i - 1]
	for i in range(2, 2 * k + 1):
		count = l[i] - s[i]
		coun.append(count + 2 * (n // 2 - l[i]))
	print(min(coun))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		le = []
		lo = []
		for i in range(1, n // 2 + 1):
			le.append(2 * i)
			lo.append(2 * i + 1)
		le[-1] += n // 2
		print('YES')
		print(' '.join(map(str, le + lo)))
	else:
		print('NO')


import sys
t = int(input())
for _ in range(t):
	arr = input().split(' ')
	n = int(arr[0])
	k = int(arr[1])
	arr = input().split()
	arr = list(map(int, arr))
	ks = [0] * (2 * k + 2)
	for i in range(int(n / 2)):
		left = arr[i]
		right = arr[n - i - 1]
		if left > right:
			(left, right) = (right, left)
		ks[2] += 2
		ks[left + 1] -= 1
		ks[left + right] -= 1
		ks[left + right + 1] += 1
		ks[right + k + 1] += 1
	sum = 0
	minvalue = 99999999
	for i in range(2, k * 2 + 1):
		sum += ks[i]
		minvalue = min(minvalue, sum)
	print(minvalue)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	if not n % 4 == 0:
		print('NO')
	else:
		print('YES')
		a = [0] * n
		for i in range(0, n // 2, 1):
			a[i] = i * 2 + 2
			a[i + n // 2] = i * 2 + 1
		a[-1] += n // 2
		for i in a:
			print(i, end=' ')
		print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	b = {}
	flag = 0
	flag1 = 0
	c = [0 for i in range(2 * k + 2)]
	while i < n // 2:
		if b.get(a[i] + a[j]) == None:
			b[a[i] + a[j]] = 1
		else:
			b[a[i] + a[j]] += 1
		c[min(a[i], a[j]) + 1] += 1
		c[max(a[i], a[j]) + k + 1] -= 1
		i += 1
		j -= 1
	for i in range(3, 2 * k + 1):
		c[i] += c[i - 1]
	mi = n
	for i in range(2, 2 * k + 1):
		d = 0
		if b.get(i) != None:
			d = b[i]
		e = c[i] - d
		f = n // 2 - (e + d)
		mi = min(mi, e + 2 * f)
	print(mi)


t = int(input())
out = []
for _ in range(t):
	n = int(input()) // 2
	if n % 2:
		out.append('NO')
	else:
		out.append('YES')
		l = []
		l2 = []
		for i in range(n // 2):
			l.append(6 * i + 2)
			l.append(6 * i + 4)
			l2.append(6 * i + 1)
			l2.append(6 * i + 5)
		out.append(' '.join(map(str, l)) + ' ' + ' '.join(map(str, l2)))
print(*out, sep='\n')


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for i in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		print(*list(range(2, n + 1, 2)) + list(range(1, n - 2, 2)) + [(3 * n - 2) // 2])
	else:
		print('NO')


for i in range(int(input())):
	x = int(input())
	(a, k) = ('', 0)
	if x // 2 % 2 == 0:
		print('YES')
		for j in range(2, x + 1, 2):
			a += str(j) + ' '
		for k in range(1, x - 1, 2):
			a += str(k) + ' '
		print(a + str(k + 2 + x // 2))
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	if n % 2 == 0 and n % 4 == 0:
		left = [2 * i for i in range(1, n // 2 + 1)]
		right = [2 * i - 1 for i in range(1, n // 2)]
		right.append(sum(left) - sum(right))
		left += right
		print('YES')
		print(' '.join([str(i) for i in left]))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		c = 2
		count = 0
		for i in range(n // 2):
			print(c, end=' ')
			count += c
			c += 2
		c = 1
		cc = 0
		for i in range(n // 2 - 1):
			print(c, end=' ')
			cc += c
			c += 2
		print(count - cc)


import sys
t = int(sys.stdin.readline())
for query in range(t):
	n = int(sys.stdin.readline())
	half = n // 2
	if half % 2 == 0:
		print('YES')
		two = 2
		for i in range(half):
			print(two, end=' ')
			two += 2
		two = 1
		for i in range(half - 1):
			print(two, end=' ')
			two += 2
		print(half * 3 - 1)
	else:
		print('NO')


for _ in range(int(input())):
	(n,) = map(int, input().split())
	if n % 4 > 0:
		print('NO')
	else:
		x = [2 * i + 2 for i in range(n // 2)]
		y = [2 * i + 1 for i in range(n // 2 - 1)]
		y.append(sum(x) - sum(y))
		x.extend(y)
		print('YES')
		print(*x)


def solve(n):
	if n % 4 != 0:
		return 'NO'
	a = ''
	for i in range(1, int(n / 2 + 1)):
		a += str(2 * i) + ' '
	b = ''
	for i in range(1, int(n / 2)):
		b += str(2 * i - 1) + ' '
	b += str(int((3 * n - 2) / 2))
	return 'YES' + '\n' + a + b
t = int(input())
list1 = []
for _ in range(0, t):
	n = int(input())
	list1.append(solve(n))
for i in list1:
	print(i)


from sys import stdin, stdout

def find(N):
	if N % 4:
		return 'NO'
	arr = [-1] * N
	k = 2
	for i in range(N // 2):
		arr[N - i - 1] = k + 1
		if i % 2:
			k += 2
		arr[i] = k
		k += 2
	return 'YES\n' + ' '.join(map(str, arr))

def main():
	for i in range(int(input())):
		N = int(stdin.readline())
		stdout.write(str(find(N)) + '\n')
main()


T = int(input())
for i in range(T):
	m = int(input())
	half = m // 2
	if half % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(half):
			print(2 + 2 * i, end=' ')
		for j in range(half):
			if j == half - 1:
				sec = half // 2
				print(1 + 2 * (half + sec - 1))
			else:
				print(1 + 2 * j, end=' ')


def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	base = [4, 8, 5, 7]
	ret = []
	for z in range(2):
		for i in range(0, n, 4):
			ret.extend(list(map(lambda x: x + i * 100, base[2 * z:2 * z + 2])))
	print('YES')
	for i in range(0, n):
		print(ret[i], end=' ')
	print()

def main():
	T = int(input())
	for tt in range(T):
		n = int(input())
		solve(n)
main()


size = int(input())
x = 0
ls1 = []
ls2 = []
for i in range(size):
	x = int(input())
	div = int(x / 2)
	sum_even = int(div * (div + 1))
	odd_number = (div - 1) * (div - 1)
	sum_odd = 0
	if (sum_even - odd_number) % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, x + 1, 2):
			ls1.append(i)
		for i in range(1, x - 1, 2):
			sum_odd += i
			ls2.append(i)
		ls2.append(sum_even - sum_odd)
		ls1 += ls2
		for i in range(len(ls1)):
			print(ls1[i], end=' ')
		print()
		ls1.clear()
		ls2.clear()


test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append(int(input()))
for j in range(test_case):
	if my_list[j] / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		k_total = 0
		for k in range(2, my_list[j] + 1, 2):
			print(k, end=' ')
			k_total = k_total + k
		l_total = 0
		for l in range(1, my_list[j] - 2, 2):
			print(l, end=' ')
			l_total = l_total + l
		print(k_total - l_total)


for _ in range(int(input())):
	n = int(input())
	rem = n // 2
	if rem % 2 == 1:
		print('NO')
	else:
		print('YES')
		digit = []
		for x in range(1, n // 2 + 1):
			digit.append(x * 2)
		calc = sum(digit)
		val = len(digit)
		anotherdigit = []
		for x in range(1, val ** 4, 2):
			if len(anotherdigit) == val - 1:
				break
			digit.append(x)
			anotherdigit.append(x)
		if len(digit) < n:
			digit.append(calc - sum(anotherdigit))
		for x in digit:
			print(x, end=' ')
		print()


n = int(input())
for i in range(n):
	l1 = []
	l2 = []
	a = int(input())
	if a // 2 % 2 == 0:
		print('YES')
		for j in range(1, a + 1):
			if j % 2 == 0:
				l1.append(j)
			elif j == a - 1:
				l2.append(j + a // 2)
			else:
				l2.append(j)
		print(*l1 + l2)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		l1 = []
		for j in range(1, n // 2 + 1):
			l.append(2 * j)
		for j in range(len(l) - 1):
			l1.append(l[j] - 1)
		k = n // 2 - 1
		l1.append(k + l[k])
		for i in l:
			print(i, end=' ')
		for i in l1:
			print(i, end=' ')
		print()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	n1 = n // 2
	l = []
	j1 = 2
	j2 = 1
	suma1 = 0
	suma2 = 0
	for i in range(n1):
		l.append(j1)
		suma1 += j1
		j1 += 2
	for i in range(n1 - 1):
		l.append(j2)
		suma2 += j2
		j2 += 2
	if suma1 - suma2 <= 10 ** 9 and (suma1 - suma2) % 2 != 0:
		l.append(suma1 - suma2)
		suma1 = suma2
	if suma1 == suma2:
		print('YES')
		for i in range(n):
			print(l[i], end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	var = n // 2
	if var % 2 == 1:
		print('NO')
	else:
		print('YES')
		num = 2
		my_sum = 0
		for i in range(var):
			print(num, end=' ')
			my_sum += num
			num += 2
		num = 1
		sum2 = 0
		for i in range(var):
			if i == var - 1:
				print(my_sum - sum2)
				break
			sum2 += num
			print(num, end=' ')
			num += 2


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=' '):
	print(sep.join(map(str, a)))

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

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	if n // 2 % 2:
		print('NO')
		continue
	res = []
	s = 0
	c = 2
	for i in range(n // 2):
		res.append(c)
		s += c
		c += 2
	c = 1
	for i in range(n // 2 - 1):
		res.append(c)
		s -= c
		c += 2
	res.append(s)
	print('YES')
	prr(res, ' ')


def find_even(n):
	num = 2
	ev_lst = list()
	while True:
		if num > n:
			break
		ev_lst.append(num)
		num += 2
	return ev_lst
test = int(input())
while test > 0:
	n = int(input())
	if not n / 2 % 2 == 0:
		print('No')
	else:
		print('YES')
		even_lst = find_even(n)
		odd_lst = list()
		for i in range(len(even_lst)):
			if i == len(even_lst) - 1:
				odd_lst.append(even_lst[i] + len(even_lst) - 1)
				break
			odd_lst.append(even_lst[i] - 1)
		actual_list = list()
		for number in even_lst:
			actual_list.append(number)
		for number in odd_lst:
			actual_list.append(number)
		print(*actual_list)
	test = test - 1


import math
for o in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = [0] * n
		j = 0
		for i in range(2, 2 * (n // 2) + 1, 2):
			a[j] = i
			j = j + 1
		for i in range(1, 2 * (n // 2) - 1, 2):
			a[j] = i
			j = j + 1
		a[j] = 3 * (n // 2) - 1
		print(*a)
	else:
		print('NO')


import sys
stream = sys.stdin
t = int(stream.readline())
for n in stream:
	n = int(n)
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
	c = 3
	L = []
	R = []
	for _ in range(n // 4):
		print(f'{c - 1} {c + 1} ', end='')
		R.append(c - 2)
		R.append(c + 2)
		c += 6
	for r in R:
		print(r, end=' ')
	print()


test = int(input())
for i in range(test):
	inputvalue = int(input())
	newlist = []
	newvalue = inputvalue // 2
	if inputvalue % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(1, newvalue + 1):
			newlist.append(2 * j)
		for k in range(1, newvalue + 1):
			if k != newvalue:
				newlist.append(2 * k - 1)
			else:
				newlist.append(2 * newvalue * (newvalue + 1) - sum(newlist))
		for x in newlist:
			print(x, end=' ')


def solve(n):
	assert n % 2 == 0
	if n % 4 != 0:
		return 'NO'
	assert n >= 4
	even_a = list(range(2, n + 2, 2))
	even_a[-1] += 100000
	assert len(even_a) == n // 2
	odd_a = list(range(1, n - 1, 2))
	assert len(odd_a) == n // 2 - 1
	pair_sum = sum(even_a)
	odd_sum = sum(odd_a)
	a = [*even_a, *odd_a, pair_sum - odd_sum]
	assert len(set(a)) == len(a)
	return 'YES\n' + ' '.join(map(str, a))

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		print(solve(n))
main()


t = int(input())
import math
for _ in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	l = list(map(int, input().split()))
	d = {}
	f = {}
	m = {}
	tot = set()
	for i in range(n // 2):
		(a, b) = (l[i] - 1, l[-i - 1] - 1)
		(a, b) = sorted([a, b])
		if a in d:
			d[a] += 1
		else:
			d[a] = 1
		if b + k in f:
			f[b + k] += 1
		else:
			f[b + k] = 1
		if a + b in m:
			m[a + b] += 1
		else:
			m[a + b] = 1
		tot.add(a)
		tot.add(b + k)
		tot.add(a + b)
	tot = sorted(list(tot))
	score = n
	mini = score
	for x in tot:
		if x in d:
			score -= d[x]
		if x in m:
			score -= m[x]
			mini = min(mini, score)
			score += m[x]
		else:
			mini = min(mini, score)
		if x in f:
			score += f[x]
	print(mini)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(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

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	if n // 2 % 2 != 0:
		stdout.write(str('NO') + '\n')
	else:
		l = []
		a = 2
		for i in range(n // 2):
			l.append(a)
			a = a + 2
		j = 0
		for i in range(n // 2):
			if i == n // 2 - 1:
				l.append(l[j] + n // 2 - 1)
			else:
				l.append(l[j] - 1)
			j = j + 1
		stdout.write(str('YES') + '\n')
		print(*l)


t = int(input())
for z in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		l = []
		r = []
		x = 2
		f = True
		for i in range(int(n / 2)):
			l.append(x)
			if f:
				r.append(x - 1)
				x += 2
			else:
				r.append(x + 1)
				x += 4
			f = not f
		l.extend(r)
		print('YES')
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		print(*[2 * x for x in range(1, n // 2 + 1)], *[2 * x - 1 for x in range(1, n // 2)], 3 * n // 2 - 1, sep=' ')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	first = [i * 2 for i in range(1, n // 2 + 1)]
	second = [i * 2 - 1 for i in range(1, n // 2)]
	second.append(sum(first) - sum(second))
	print('YES')
	print(*first, *second)


t = int(input())
for i in range(0, t):
	length = int(input())
	listA = []
	if length % 4 == 2:
		print('NO')
	elif length % 2 == 1:
		print('NO')
	else:
		print('YES')
		sumB = 0
		for i in range(0, length // 2):
			listA.append((i + 1) * 2)
			sumB += (i + 1) * 2
		for y in range(0, length // 2 - 1):
			listA.append(y * 2 + 1)
			sumB += -(y * 2 + 1)
		listA.append(sumB)
		print(*listA)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	cost = [0] * (2 * k + 2)
	count = [0] * (2 * k + 2)
	for i in range(n // 2):
		cost[min(l[i] + 1, l[n - i - 1] + 1)] += 1
		cost[max(l[i] + k, l[n - i - 1] + k) + 1] -= 1
		if min(l[i] + 1, l[n - i - 1] + 1) - 1 >= 2:
			cost[2] += 2
			cost[min(l[i] + 1, l[n - i - 1] + 1)] -= 2
		if max(l[i] + k, l[n - i - 1] + k) + 1 <= 2 * k:
			cost[max(l[i] + k, l[n - i - 1] + k) + 1] += 2
			cost[2 * k + 1] -= 2
		cost[l[i] + l[n - i - 1]] -= 1
		cost[l[i] + l[n - i - 1] + 1] += 1
	for i in range(2, 2 * k + 1):
		cost[i] = cost[i] + cost[i - 1]
	ans = cost[2 * k]
	for i in range(2, 2 * k + 1):
		ans = min(ans, cost[i])
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pre = [0] * (2 * k + 2)
	d = [0] * (2 * k + 2)
	for i in range(n // 2):
		pre[min(a[i], a[n - i - 1]) + 1] += -1
		pre[max(a[i], a[n - i - 1]) + k + 1] += 1
		d[a[i] + a[n - i - 1]] += 1
	for i in range(1, 2 * k + 1):
		pre[i] += pre[i - 1]
	ans = n
	for i in range(1, 2 * k + 1):
		ans = min(ans, n + pre[i] - d[i])
	print(ans)


n = int(input())
count = 0
dat = []
while count < n:
	s = int(input())
	dat.append(s)
	count += 1
for x in dat:
	if x // 2 % 2 != 0:
		print('NO')
	else:
		even = []
		odd = []
		count = 1
		print('YES')
		for y in range(1, x // 2):
			odd.append(count)
			count += 1
			even.append(count)
			count += 1
		count += 1
		even.append(count)
		sum_even = sum(even)
		sum_odd = sum(odd)
		last_odd = sum_even - sum_odd
		odd.append(last_odd)
		total = ''
		for x in even:
			total += str(x)
			total += ' '
		for z in odd:
			total += str(z)
			total += ' '
		print(total)


n = int(input())
for i in range(n):
	l = int(input())
	if l % 4 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(int(l / 2)):
			print((j + 1) * 2, end=' ')
		for j in range(int(l / 2 - 1)):
			print((j + 1) * 2 - 1, end=' ')
		print(int(l * 1.5 - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	k = (n // 2) ** 2
	if k % 2 == 1:
		print('NO')
		continue
	print('YES')
	for i in range(2, 2 * (n // 2) + 1, 2):
		print(i, end=' ')
	i = 0
	f = 1
	while i < n // 2 - 1:
		print(f, end=' ')
		f += 2
		i += 1
	m = (n // 2 - 1) ** 2
	g = n // 2 * (n // 2 + 1)
	print(g - m)


for _ in range(int(input())):
	n = int(input())
	k = 0
	l = -1
	even = []
	odd = []
	odd1 = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			k += 2
			l += 2
			even.append(k)
			odd.append(l)
		h = odd[-1] + n // 2
		odd1.append(h)
		print(*even + odd[:-1] + odd1)


t = int(input())
ans = []
for _ in range(1, t + 1):
	n = int(input())
	p = n // 2
	sumeven = p * (p + 1)
	sumodd = (p - 1) ** 2
	if (sumeven - sumodd) % 2 == 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, p + 1):
			print(i * 2, end=' ')
		a = 1
		for i in range(1, p):
			print(a, end=' ')
			a = a + 2
		z = sumeven - sumodd
		print(z)


for i in range(int(input())):
	num = int(input())
	if num % 4 == 0:
		lis = []
		print('YES')
		for n in range(2, num + 1, 2):
			print(n, end=' ')
			lis.append(n)
		c = 0
		for k in lis:
			if k == num:
				print(num + c, end=' ')
				break
			else:
				print(k - 1, end=' ')
				c += 1
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	if n // 4 == n / 4:
		print('YES')
		p = n // 2
		sum = 0
		j = 2
		while p:
			sum += j
			print(j, end=' ')
			p -= 1
			j += 2
		j = 1
		p = n // 2
		while p - 1:
			sum -= j
			print(j, end=' ')
			j += 2
			p -= 1
		print(sum)
	else:
		print('NO')


def answer():
	n = int(input())
	potato = n
	ans = []
	while n:
		a = int(input())
		if a % 4:
			ans.append('NO')
		else:
			ans.append('YES')
			c = [2 * i for i in range(1, int(a / 2) + 1)]
			d = [i * 2 - 1 for i in range(1, int(a / 2))]
			e = c[-1] + len(d)
			d.append(e)
			for x in d:
				c.append(x)
			targ = ''
			i = 0
			while i < len(c):
				targ += str(c[i])
				if i != len(c) - 1:
					targ += ' '
				i += 1
			ans.append(targ)
		n -= 1
	i = 0
	for x in ans:
		print(x)
answer()


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
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	pre = [0] * (2 * k + 10)
	hash = defaultdict(int)
	for i in range(n // 2):
		(x, y) = sorted([l[i], l[n - i - 1]])
		hash[x + y] += 1
		pre[x + 1] += 1
		pre[y + k + 1] -= 1
	for i in range(1, len(pre)):
		pre[i] += pre[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		cnt0 = hash[i]
		cnt1 = pre[i] - cnt0
		cnt2 = n // 2 - (cnt1 + cnt0)
		ans = min(ans, cnt1 + 2 * cnt2)
	print(ans)


def problem1():
	a = int(input())
	k = 4
	while a % (k - 1) != 0:
		k *= 2
	print(a // (k - 1))

def problem2():
	a = int(input())
	if a % 4 == 2:
		print('NO')
		return
	print('YES')
	x = []
	for i in range(1, a // 2 + 1):
		x.append(2 * i)
	for i in range(a // 4):
		x.append(x[i] - 1)
	for i in range(a // 4, a // 2):
		x.append(x[i] + 1)
	print(*x)

def problem3():
	l = int(input())
	a = list(map(int, input().split()))
	k = -1 * min(a)
	i = 0
	s = 0
	while i < l:
		mp = 0
		mn = k + 1
		while i < l and a[i] > 0:
			mp = max(a[i], mp)
			i += 1
		while i < l and a[i] < 0:
			mn = min(abs(a[i]), mn)
			i += 1
		s += mp
		if mn != k + 1:
			s -= mn
	print(s)

def problem4():
	(l, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	s = []
	t = []
	u = []
	for i in range(l // 2):
		s.append(a[i] + a[l - i - 1])
		t.append(min(1 + a[i], 1 + a[l - i - 1]))
		u.append(max(k + a[i], k + a[l - i - 1]))
	v = list(set([(s.count(i), i) for i in s]))
cases = int(input())
for _ in range(cases):
	problem2()


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	arr = list(range(2, n + 1, 2))
	s = n // 4 * (4 + 2 * (n // 2 - 1))
	s1 = sum(range(1, n - 1, 2))
	arr.extend(list(range(1, n - 1, 2)))
	arr.append(s - s1)
	print(*arr, sep=' ')


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		lis = []
		for i in range(1, n // 2 + 1):
			lis.append(i * 2)
		for j in range(1, n // 2 + 1):
			if j == n // 2:
				lis.append(j + 2 * j - 1)
			else:
				lis.append(2 * j - 1)
		print('YES')
		print(*lis)


t = int(input())
for vall in range(t):
	n = int(input())
	n = int(n / 2)
	if n % 2 != 0:
		print('NO')
		continue
	l1 = []
	l2 = []
	for val in range(1, n + 1):
		l1 += [val * 2]
		l2 += [val * 2 - 1]
	l = l1 + l2
	l[2 * n - 1] = l[2 * n - 1] + n
	print('YES')
	print(*l)


for _ in range(int(input())):
	a = int(input())
	ea = []
	oa = []
	if a // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		x = int(1)
		while 2 * x <= a:
			ea.append(2 * x)
			x = x + 1
		x = int(0)
		while x <= a // 2:
			oa.append(2 * x + 1)
			x = x + 1
		oa.pop(a // 4)
		ea.extend(oa)
		print(*ea)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	temp = n // 2
	if temp % 2 == 1:
		print('NO')
	else:
		arr = [0] * n
		for i in range(1, n // 2 + 1):
			arr[i - 1] = 2 * i
			arr[n // 2 + i - 1] = 2 * i - 1
		arr[n - 1] += n // 2
		string = str(arr[0])
		for i in range(1, n):
			string += ' ' + str(arr[i])
		print('YES')
		print(string)


t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	for i in range(n):
		ans.append(0)
	if n / 2 % 2 == 0:
		for i in range(int(n / 2)):
			ans[i] = 2 + 2 * i
			ans[int(i + n / 2)] = 1 + 2 * i
		if sum(ans[0:int(n / 2)]) != sum(ans[int(n / 2 + 1):n - 1]):
			ans[n - 1] = sum(ans[0:int(n / 2)]) - sum(ans[int(n / 2):n - 1])
		print('YES')
		for num in ans:
			(print(num),)
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	a = []
	if int(n / 2) % 2 == 0:
		a = [i for i in range(0, int(n / 2), 2)]
		for i in range(n, int(n / 2) + n, 2):
			a.append(i)
		for i in range(int(n / 4)):
			a.append(a[i] + 1)
		for i in range(int(n / 4), int(n / 2)):
			a.append(a[i] - 1)
		for i in range(n):
			a[i] += 2
		stdout.write('YES' + '\n' + str(' '.join(map(str, a))) + '\n')
	else:
		stdout.write('NO' + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = n // 2
		l1 = [j for j in range(2, n + 1, 2)]
		l2 = [j for j in range(1, n - 1, 2)]
		l2.append(n - 1 + k)
		l1.extend(l2)
		for j in l1:
			print(j, end=' ')
		print()


def balanced_array(n):
	a = [0] * n
	(i, j) = (0, 1)
	if n % 4 == 0:
		print('YES')
		while i < int(n / 2):
			a[int(n / 2) + i] = j
			a[i] = j + 1
			j += 2
			i += 1
			if i == int(n / 2):
				a[n - 1] += i
		k = 0
		while k < n:
			print(a[k], end=' ')
			k += 1
	else:
		print('\nNO')
i = 0
t = int(input())
arr = [0] * t
while i < t:
	arr[i] = int(input())
	i += 1
j = 0
while j < t:
	balanced_array(arr[j])
	j += 1


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n / 2 % 2 != 0:
		print('No')
	else:
		print('Yes')
		sol = [2]
		times = n / 2 - 1
		while times > 0:
			sol.append(sol[-1] + 2)
			times -= 1
		sol.append(1)
		times = n / 2 - 2
		while times > 0:
			sol.append(sol[-1] + 2)
			times -= 1
		sol.append(sum(sol[:int(n / 2)]) - sum(sol[int(n / 2):]))
		print(*sol)


t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = [0] * n
		even = 2
		odd = 1
		sum_even = 0
		sum_odd = 0
		for i in range(n // 2):
			arr[i] = even
			sum_even += even
			even += 2
		for i in range(n // 2, n - 1):
			arr[i] = odd
			sum_odd += odd
			odd += 2
		arr[n - 1] = sum_even - sum_odd
		for a in arr:
			print(a, end=' ')
		print()
	t -= 1


for _ in range(int(input())):
	qtd = int(input())
	pares = [i * 2 for i in range(1, qtd // 2 + 1)]
	impares = [i * 2 + 1 for i in range(qtd // 2 - 1)]
	pares_sum = sum(pares)
	impares_sum = sum(impares)
	diferenca = pares_sum - impares_sum
	if diferenca % 2 != 0:
		print('YES')
		print(*pares, *impares, diferenca)
	else:
		print('NO')


for j in range(int(input())):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	X = 10 ** 10
	B = []
	X0 = len(A)
	for i in range(len(A) // 2):
		B.append([min(A[i], A[-i - 1]) + 1, -1])
		B.append([k + max(A[i], A[-i - 1]) + 1, 1])
		B.append([A[i] + A[-i - 1], -1])
		B.append([A[i] + A[-i - 1] + 1, 1])
	B.sort(key=lambda n: n[0])
	for i in range(len(B)):
		if i > 0:
			if B[i][0] != B[i - 1][0]:
				if X0 < X:
					X = X0
		X0 += B[i][1]
	print(X)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lower = 2
	upper = 2 * k
	a = list(map(int, input().split()))
	b = [sorted([a[i], a[n - i - 1]]) for i in range(n >> 1)]
	d = [0] * (2 * k + 2)
	d[0] = n
	for e in b:
		d[min(e) + 1] -= 1
		d[max(e) + k + 1] += 1
		d[sum(e)] -= 1
		d[sum(e) + 1] += 1
	for i in range(1, 2 * k + 1):
		d[i] += d[i - 1]
	print(min(d[2:2 * k + 1]))


n = int(input())
a = []
for j in range(n):
	x = int(input())
	if x // 2 % 2 != 0:
		a.append(['NO'])
	else:
		b = []
		for i in range(1, x // 2 + 1):
			b.append(2 * i)
		for i in range(1, x // 4 + 1):
			b.append(b[i - 1] - 1)
		for i in range(x // 4 + 1, x // 2 + 1):
			b.append(b[i - 1] + 1)
		a.append(['YES'])
		a.append(b)
for i in range(len(a)):
	for j in range(len(a[i])):
		print(a[i][j], end=' ')
	print()


t = int(input(''))
nn = []
for i in range(t):
	nn.append(int(input('')))
for i in range(t):
	n = nn[i]
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		se = 0
		n = int(n / 2)
		for j in range(1, n + 1):
			ans.append(2 * j)
			se = se + 2 * j
		so = 0
		for j in range(1, n):
			ans.append(2 * j - 1)
			so = so + 2 * j - 1
		ans.append(se - so)
		print(*ans)


from collections import defaultdict
for T in range(int(input())):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	d = defaultdict(int)
	prefix = [0] * (2 * k + 2)
	for i in range(n // 2):
		d[arr[i] + arr[n - 1 - i]] += 1
		prefix[min(arr[i], arr[n - i - 1]) + 1] += 1
		prefix[max(arr[i], arr[n - i - 1]) + k + 1] -= 1
	mini = float('inf')
	for i in range(2, 2 * k + 2):
		prefix[i] += prefix[i - 1]
	for i in range(2, 2 * k + 2):
		temp = n - prefix[i] - d[i]
		if temp < mini:
			mini = temp
	print(mini)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		n = n // 2
		for e in range(1, n + 1):
			print(2 * e, end=' ')
		for od in range(1, n):
			print(2 * od - 1, end=' ')
		print(n * (n + 1) - (n - 1) * (n - 1))


for i in range(int(input())):
	a = int(input())
	if int(a / 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		c = int(a / 2)
		d = []
		e = []
		r = 1
		t = 2
		for k in range(1, c):
			d.append(str(r))
			e.append(str(t))
			r += 2
			t += 2
		e.append(str(t))
		d.append(str(int(e[-1]) + c - 1))
		e.extend(d)
		print(' '.join(e))


for i in range(int(input())):
	(a, b) = (2, 1)
	l = []
	m = []
	n = int(input())
	if n % 4 == 0:
		print('YES')
		x = n // 2
		for j in range(n):
			if j < x:
				l.append(a)
				a += 2
			if x < j < n:
				m.append(b)
				b += 2
			if j == n - 1:
				m.append(sum(l) - sum(m))
		l += m
		for i in l:
			print(i, end=' ')
		print()
	else:
		print('NO')


import sys
input = sys.stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		if n % 4 != 0:
			print('NO')
			continue
		ara = [0] * n
		for i in range(n // 2):
			ara[i] = (i + 1) * 2
			ara[i + n // 2] = ara[i] - 1
		ara[n - 1] += n // 2
		print('YES')
		ans = ' '.join(map(str, ara))
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		a = []
		for i in range(1, n // 2 + 1):
			a.append(i * 2)
		s = sum(a)
		s1 = 0
		for i in range(1, n // 2):
			x = i * 2 - 1
			a.append(x)
			s1 += x
		a.append(s - s1)
		print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	side = n // 2
	if side % 2 == 1:
		print('NO')
	else:
		print('YES')
		es = 0
		os = 0
		for i in range(2, 2 * side + 1, 2):
			es += i
			print(i, end=' ')
		for i in range(1, 2 * side - 1, 2):
			os += i
			print(i, end=' ')
		print(es - os)


from collections import Counter
from _collections import defaultdict
import math
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	cnt = defaultdict(lambda : 0)
	for i in range(0, n // 2):
		cnt[a[i] + a[n - 1 - i]] += 1
	pref = [0] * (2 * k + 2)
	for i in range(0, n // 2):
		pref[min(a[i], a[n - 1 - i]) + 1] += 1
		pref[max(a[i], a[n - 1 - i]) + k + 1] -= 1
	for i in range(2, 2 * k + 1):
		pref[i] = pref[i] + pref[i - 1]
	ans = 99999999
	for i in range(2, 2 * k + 1):
		ans = min(ans, pref[i] - cnt[i] + 2 * (n // 2 - pref[i]))
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = []
	b = []
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(int(n / 2)):
			a.append(int(2 * (i + 1)))
		s1 = sum(a)
		for j in range(int(n / 2) - 1):
			b.append(int(2 * j + 1))
		s2 = sum(b)
		a.extend(b)
		a.append(int(s1 - s2))
		for x in a:
			print(x, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		b = []
		c = []
		p = 2
		k = 0
		i = 0
		while i < n // 2:
			b.append(p)
			if k % 2 == 0:
				k += 1
				p = p + 2
			else:
				k += 1
				p = p + 4
			i += 1
		p = 1
		k = 0
		i = 0
		while i < n // 2:
			b.append(p)
			if k % 2 == 0:
				k += 1
				p = p + 4
			else:
				k += 1
				p = p + 2
			i += 1
		print(*b)
	else:
		print('NO')


import fileinput
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(n // 2):
			l.append(2 * i + 2)
		for i in range(n // 2 - 1):
			l.append(2 * i + 1)
		l.append(n // 2 * (n // 2 + 1) - (n // 2 - 1) * (n // 2 - 1))
		print(' '.join([str(x) for x in l]))


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	pre = []
	for i in range(2 * k + 1 + 1):
		pre.append(0)
	d = {}
	for i in range(n // 2):
		if l[i] + l[n - i - 1] in d:
			d[l[i] + l[n - i - 1]] += 1
		else:
			d[l[i] + l[n - i - 1]] = 1
		x = min(l[i], l[n - i - 1]) + 1
		y = max(l[i], l[n - i - 1]) + k + 1
		pre[x] += 1
		pre[y] -= 1
	for i in range(1, 2 * k + 1):
		pre[i] += pre[i - 1]
	ans = n
	for i in range(2, 2 * k + 1):
		if i in d:
			x = 2
		else:
			d[i] = 0
		ans = min(ans, pre[i] - d[i] + (n // 2 - pre[i]) * 2)
	print(ans)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = list(range(2, 2 * a // 2 + 1, 2))
		r = []
		for i in l[:a // 4]:
			r.append(i - 1)
		for i in l[a // 4:]:
			r.append(i + 1)
		print(*l, *r)


for t in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	(z1, z2) = (2, 1)
	(r1, r2) = ([2], [1])
	for i in range(1, n // 2):
		(a, b) = (r1[-1] + 2, r2[-1] + 2)
		z1 += a
		z2 += b
		r1.append(a)
		r2.append(b)
	r2[-1] = z1 - (z2 - b)
	print(*r1 + r2)


n = int(input())
for peradaban in range(n):
	a = int(input())
	if a % 4 != 0:
		print('NO')
		continue
	print('YES')
	for i in range(a // 2):
		print((i + 1) * 2, end=' ')
	for i in range(a // 2 - 1):
		print(2 * i + 1, end=' ')
	print(a + a // 2 - 1)


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except FileNotFoundError:
	pass
for tc in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		sm_left = 0
		sm_right = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			sm_left += i
		for i in range(1, n - 1, 2):
			print(i, end=' ')
			sm_right += i
		print(sm_left - sm_right)


def ab():
	b = int(input())
	l = []
	if b == 2:
		print('NO')
		return
	if b % 4 == 0:
		print('YES')
		for i in range(2, b + 1, 2):
			l.append(i)
		p = len(l)
		for i in range(0, p - 1):
			l.append(l[i] - 1)
		l.append(b + b // 2 - 1)
		print(*l)
		return
	else:
		print('NO')
		return
for i in range(0, int(input())):
	ab()


a = int(input())
for i in range(a):
	b = int(input())
	if b % 4 == 0:
		print('YES')
		c = []
		for j in range(2, b + 1, 2):
			c.append(j)
		k = 1
		for j in range(b // 2 - 1):
			c.append(k)
			k += 2
		c.append(sum(c[:b // 2 + 1]) - sum(c[b // 2 + 1:]) - 2)
		print(*c)
	else:
		print('NO')


t = int(input())

def sfun(num):
	return int(num * (num + 1) / 2)
for i in range(t):
	n = int(input())
	temp = int(n / 2) % 2 == 0
	if temp:
		print('YES')
		acum = 0
		for j in range(2, n + 1, 2):
			print(j, end=' ')
			acum += j
		for j in range(1, n - 1, 2):
			print(j, end=' ')
			acum -= j
		print(acum)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		od_lis = []
		even_lis = []
		print('YES')
		s = 0
		ctr = 0
		for i in range(2, n + 1, 2):
			even_lis.append(i)
			ctr += 1
			s += i
		x = 1
		for i in range(0, ctr - 1):
			od_lis.append(x)
			x += 2
		od_lis.append(s - sum(od_lis))
		print(*even_lis + od_lis)


import sys
import collections
import itertools
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, K) = [int(x) for x in input().split()]
		A = [int(x) for x in input().split()]
		ans = N // 2
		c = collections.Counter()
		x = 0
		y = 0
		B = [0] * (2 * K + 2)
		for i in range(N // 2):
			B[min(A[i], A[-1 - i]) + 1] += 1
			B[max(A[i], A[-1 - i]) + K + 1] -= 1
			c[A[i] + A[-1 - i]] += 1
		ruiseki = list(itertools.accumulate(B))
		for (i, v) in enumerate(ruiseki):
			tmp = N
			tmp -= c[i]
			tmp -= v
			ans = min(ans, tmp)
		print(ans)
main()


for T in range(int(input())):
	n = int(input())
	k = n // 2
	rem = k % 2
	if rem == 1:
		print('NO')
	else:
		arr = []
		i = 0
		x = 2
		y = 1
		right = 0
		left = 0
		while i < n:
			if i < n // 2:
				arr.append(x)
				right += x
				x += 2
			elif i != n - 1:
				arr.append(y)
				left += y
				y += 2
			else:
				arr.append(right - left)
			i += 1
		print('YES')
		print(*arr)


def solve():
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	cnt = [0] * (2 * k + 2)
	for i in range(n // 2):
		sum = a[i] + a[n - i - 1]
		cnt[2] += 2
		cnt[sum - max(a[i], a[n - i - 1]) + 1] -= 1
		cnt[sum] -= 1
		cnt[sum + 1] += 1
		cnt[sum + k - min(a[i], a[n - i - 1]) + 1] += 1
	ans = n
	for i in range(2, 2 * k + 1):
		cnt[i] += cnt[i - 1]
		ans = min(ans, cnt[i])
	print(ans)
t = int(input())
while t > 0:
	t -= 1
	solve()


import sys
input = sys.stdin.readline
import heapq
import copy
import math

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

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

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

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

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		n = inp()
		size = int(n / 2)
		if size % 2 == 1:
			print('NO')
			continue
		ans = []
		curr = 2
		sums = 0
		for i in range(size):
			ans.append(curr)
			sums += curr
			curr += 2
		curr = 1
		sum_odd = 0
		for i in range(size - 1):
			ans.append(curr)
			sum_odd += curr
			curr += 2
		ans.append(sums - sum_odd)
		print('YES')
		pr_list(ans)
	return 0
main()


t = int(input())
for i in range(t):
	n = int(input())
	j = 0
	i = 1
	c = c1 = 0
	sum = 0
	sum1 = 0
	a = []
	b = []
	d = []
	j = 2
	if n % 2 == 0:
		while j % 2 == 0:
			c = c + 1
			sum = sum + j
			a.append(j)
			j = j + 2
			if c == n // 2:
				break
		while i % 2 != 0:
			c1 = c1 + 1
			if c1 > n // 2:
				break
			if c1 < n // 2:
				sum1 = sum1 + i
				b.append(i)
				i = i + 2
			while c1 == n // 2:
				sum1 = sum1 + i
				if sum1 > sum:
					break
				if sum1 == sum:
					b.append(i)
					break
				else:
					sum1 = sum1 - i
					i = i + 2
	if sum == sum1:
		d = a + b
		print('YES')
		print(*d, sep=' ')
	else:
		print('NO')


T = int(input())
out = []
for i in range(T):
	n = int(input())
	temp = n // 2
	if temp % 2 != 0:
		out.append(['NO'])
	else:
		out1 = []
		out2 = []
		count = 2
		for j in range(temp):
			out1.append(count)
			count = count + 2
		count = 1
		for j in range(temp - 1):
			out2.append(count)
			count = count + 2
		last = 3 * temp - 1
		out2.append(last)
		out.append(['YES', out1 + out2])
for i in range(T):
	if out[i][0] == 'NO':
		print(out[i][0])
	else:
		print(out[i][0])
		print(' '.join([str(num) for num in out[i][1]]))


for i in range(int(input())):
	n = int(input())
	div = n // 2
	if div % 2 == 0:
		print('YES', end='\n')
		part1 = 0
		part2 = 0
		for i in range(2, n + 1, 2):
			part1 = part1 + i
			print(i, end=' ')
		for j in range(1, n - 1, 2):
			part2 = part2 + j
			print(j, end=' ')
		print(part1 - part2, end=' ')
		print()
	else:
		print('NO', end='\n')


for _ in range(int(input())):
	n = int(input())
	l = []
	r = []
	if n % 4 != 0:
		print('NO')
	else:
		for i in range(1, int(n / 2 + 1)):
			l.append(2 * i)
			r.append(2 * i - 1)
		l.extend(r)
		print('YES')
		l[-1] += int(n / 2)
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		a = list(range(2, n + 1, 2))
		b = list(range(1, n + 1, 2))
		b.pop()
		z = sum(a) - sum(b)
		b.append(z)
		f = a + b
		s = str(f)
		s = s.replace(',', '')
		s = s[1:len(s) - 1]
		print('YES')
		print(s)


t = int(input())
while t:
	n = int(input())
	if int(n / 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		even = 2
		odd = 1
		a = []
		for i in range(int(n / 2)):
			a.append(even)
			even += 2
		for i in range(int(n / 2) - 1):
			a.append(odd)
			odd += 2
		x = 0
		y = 0
		for i in range(len(a)):
			if a[i] % 2 == 0:
				x += a[i]
			else:
				y += a[i]
		a.append(x - y)
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	if n % 2 == 1:
		print('NO')
	elif n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		p = 2
		for j in range(n // 2):
			arr.append(p)
			p += 2
		for j in range(n // 2 // 2):
			arr.append(arr[j] - 1)
		for j in range(n // 2 // 2, n // 2):
			arr.append(arr[j] + 1)
		print(*arr, sep=' ')


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		x = int(n / 2)
		list1 = []
		list2 = []
		for j in range(1, x + 1):
			list1.append(2 * j)
			list2.append(2 * j - 1)
		y = list1 + list2
		y[n - 1] += int(x)
		y = [str(h) for h in y]
		print(' '.join(y))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		k = n // 2
		o = 1
		e = 2
		odd = []
		even = []
		for i in range(k // 2):
			odd.append(o)
			odd.append(o + 4)
			o += 6
			even.append(e)
			even.append(e + 2)
			e += 6
		even.extend(odd)
		print('YES')
		print(*even)


n = int(input())
for i in range(n):
	r = int(input())
	if r % 4 == 2:
		print('NO')
	else:
		print('YES')
		count1 = 0
		count2 = 0
		for j in range(1, r // 2 + 1):
			print(2 * j, end=' ')
			count1 += 2 * j
		for j in range(1, r // 2):
			print(2 * j - 1, end=' ')
			count2 += 2 * j - 1
		print(count1 - count2)


def rangesum(n):
	s = 0
	i = 2
	c = 0
	even = []
	while c < n // 2:
		s += i
		even.append(i)
		i += 2
		c += 1
	i = 1
	c = 0
	odd = []
	s2 = 0
	while c < n // 2:
		if s2 > s:
			break
		odd.append(i)
		s2 += i
		i += 2
		c += 1
	if (s - sum(odd[0:n // 2 - 1])) % 2 != 0:
		odd[-1] = s - sum(odd[0:n // 2 - 1])
	if sum(odd) != sum(even):
		print('NO')
	else:
		print('YES')
		print(*even + odd)
for _ in range(int(input())):
	n = int(input())
	rangesum(n)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		h = n // 2
		a = 2
		b = 1
		ans = [-1] * n
		for i in range(0, h):
			ans[i] = a
			a += 2
		for i in range(h, n - 1):
			ans[i] = b
			b += 2
		ans[n - 1] = h ** 2 + h - (h - 1) ** 2
		for i in range(0, n):
			print(ans[i], end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(1, n + 1):
			l.append(2 * i)
		s = sum(l)
		for i in range(n - 1):
			l.append(2 * i + 1)
		l.append(s + s - sum(l))
		for i in l:
			print(i, end=' ')
		print()


tc = int(input())
for t in range(tc):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		se = 0
		so = 0
		for i in range(1, n // 2 + 1):
			print(2 * i, end=' ')
			se += 2 * i
		for i in range(1, n // 2):
			print(2 * i - 1, end=' ')
			so += 2 * i - 1
		print(se - so)


import sys
from math import log2, floor
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	arr = [0] * n
	ite = 2
	for i in range(n // 2):
		arr[i] = ite
		ite += 2
	ite = 1
	if n // 2 % 2 == 1:
		NO()
	else:
		YES()
		for i in range(n // 2, n):
			arr[i] = ite
			ite += 2
		arr[n - 1] = arr[n - 1] + n // 2
		print(*arr)


for _ in range(int(input())):
	n = int(input())
	b = n // 2
	if b % 2 != 0:
		print('NO')
	else:
		print('YES')
		od = []
		ev = []
		for i in range(n // 2 - 1):
			od.append(i * 2 + 1)
			ev.append(i * 2 + 2)
		ev.append(n)
		bc = sum(ev) - sum(od)
		od.append(bc)
		l = ev + od
		print(' '.join((str(x) for x in l)))


for i in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		s = 0
		x = 2
		o = []
		for i in range(n // 2):
			s += x
			o.append(x)
			x += 2
		s += n // 2
		l = sum(o[:-1])
		p = s - l
		s = 0
		x = 2
		for i in range(n // 2 - 1):
			s += x
			o.append(x - 1)
			x += 2
		o.append(p - 1)
		print('YES')
		print(' '.join([str(x) for x in o]))


t = int(input())
while t != 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		x = 2
		while x <= n:
			l.append(x)
			x += 2
		i = -1
		l1 = l[:]
		x = 1
		while x <= n:
			l.append(x)
			x += 2
		n1 = n // 2
		l = l[0:len(l) - 1]
		l1 = l[0:n1]
		l2 = l[n1:]
		ans = sum(l1) - sum(l2)
		l.append(ans)
		for i in l:
			print(i, end=' ')
		print()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	if n % 4 == 0:
		print('Yes')
		x = 0
		y = 0
		for i in range(2, n + 2, 2):
			l.append(i)
			x += i
		for i in range(1, n - 2, 2):
			l.append(i)
			y += i
		l.append(x - y)
		print(*l)
	else:
		print('No')


test = int(input())
b = [False for _ in range(200005)]
c = [False for _ in range(200005)]
d = [False for _ in range(400005)]
for t in range(0, test):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	res = 2000000000
	for i in range(0, k * 2 + 1):
		d[i] = 0
	for i in range(0, k + 2):
		b[i] = 0
		c[i] = 0
	for i in range(0, n // 2):
		d[a[n - i - 1] + a[i]] = d[a[n - i - 1] + a[i]] + 1
		b[max(a[n - i - 1], a[i])] = b[max(a[n - i - 1], a[i])] + 1
		c[min(a[n - i - 1], a[i])] = c[min(a[n - i - 1], a[i])] + 1
	for i in range(1, k + 2):
		b[i] = b[i - 1] + b[i]
	for i in range(k, -1, -1):
		c[i] = c[1 + i] + c[i]
	for i in range(0, k * 2 + 1):
		x = n // 2 - d[i]
		if k >= i:
			x = x + c[i]
		else:
			x = x + b[i - 1 - k]
		res = min(x, res)
	print(res)


def main():
	t = int(input())
	while t:
		(N, K) = map(int, input().split())
		arr = list(map(int, input().split()))
		prefix = [0 for _ in range(2 * K + 2)]
		cnt = [0 for _ in range(2 * K + 1)]
		for i in range(len(arr) // 2):
			temp = arr[i] + arr[-(i + 1)]
			temp_min = min(arr[i], arr[-(i + 1)])
			temp_max = max(arr[i], arr[-(i + 1)])
			prefix[temp_min + 1] += 1
			prefix[temp_max + K + 1] += -1
			cnt[temp] += 1
		for i in range(1, len(prefix)):
			prefix[i] += prefix[i - 1]
		min_ans = len(arr)
		for i in range(2, 2 * K + 1):
			ans = prefix[i] - cnt[i] + (N // 2 - prefix[i]) * 2
			if ans < min_ans:
				min_ans = ans
		print(min_ans)
		t -= 1
main()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	ev = []
	od = []
	boo = True
	cur = 1
	for i in range(n // 2):
		if boo:
			od.append(cur)
			ev.append(cur + 1)
			boo = False
			cur = cur + 3
		else:
			ev.append(cur)
			od.append(cur + 1)
			boo = True
			cur = cur + 3
	ans = ev + od
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n & 1:
		print('NO')
	elif n // 2 & 1:
		print('NO')
	else:
		print('YES')
		ans = [2 * x for x in range(1, n // 2 + 1)]
		s = sum(ans)
		ans += [1]
		su = 1
		for _ in range(n // 2 - 2):
			su += ans[-1] + 2
			ans.append(ans[-1] + 2)
		ans.append(s - su)
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('NO')
	elif n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		lis = [0 for i in range(n)]
		mark = 2
		for i in range(int(n / 2)):
			if i % 2 == 0:
				lis[i] = mark
				lis[int(n / 2) + i] = mark + 1
				mark += 4
			else:
				lis[i] = mark
				lis[int(n / 2) + i] = mark - 1
				mark += 2
		lis = [str(num) for num in lis]
		print(' '.join(lis))


for _ in range(int(input())):
	n = int(input())
	a = n // 2
	if a % 2 != 0:
		print('NO')
	else:
		c = []
		cc = []
		print('YES')
		for i in range(2, 2 * a + 1, 2):
			c.append(i)
		for j in range(1, 2 * a, 2):
			cc.append(j)
		cc[-1] = cc[-1] + a
		print(*c, *cc)


def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	sume = 0
	sumo = 0
	for i in range(2, n + 1, 2):
		print(i, end=' ')
		sume += i
	for i in range(1, n - 1, 2):
		print(i, end=' ')
		sumo += i
	print(sume - sumo)
t = int(input())
for _ in range(t):
	solve(int(input()))


import pdb
queries = int(input())
for _ in range(queries):
	numbers = int(input())
	if numbers // 2 % 2 != 0:
		print('NO')
	else:
		half = numbers // 2
		positive = list(range(2, numbers + 1, 2))
		negative = list(range(1, numbers - 1, 2))
		rest = sum(positive) - sum(negative)
		str_p = ' '.join(map(str, positive))
		str_n = ' '.join(map(str, negative))
		print('YES')
		print(str_p + ' ' + str_n + ' ' + str(rest))


k = int(input())
for i in range(k):
	arr = []
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(1, n // 2 + 1):
			arr.append(2 * j)
		for k in range(1, n // 2):
			arr.append(2 * k - 1)
		arr.append(3 * (n // 2) - 1)
		for l in arr:
			print(l, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	arr1 = []
	arr2 = []
	x = n // 2
	for i in range(x - 1):
		arr1.append(2 * (i + 1))
		arr2.append(2 * (i + 1) + 1)
	arr1.append(5 * n / 2)
	arr2.append(2 * n + 1)
	print('YES')
	arr = arr1 + arr2
	for i in arr:
		print(int(i), end=' ')
	print()


N = int(input())
for i in range(N):
	n = int(input())
	a = [0] * n
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = 2
		for i in range(0, k, 2):
			a[i] = l
			a[i + 1] = l + 2
			a[k + i] = l - 1
			a[k + i + 1] = l + 3
			l += 6
		for kk in a:
			print(kk, end=' ')
		print(end='\n')


n = int(input())
for i in range(n):
	a = []
	b = []
	sum = 0
	sum1 = 0
	num = int(input())
	for i in range(1, num + 1):
		if i % 2 == 0:
			a.append(i)
			sum = sum + i
		else:
			b.append(i)
			sum1 = sum1 + i
	if sum == sum1:
		print('YES')
		c = a + b
		print(*c)
	if sum != sum1:
		subtract = sum - sum1
		sum1 = sum1 - (i - 1) + (i - 1 + subtract)
		if sum == sum1 and (i - 1 + subtract) % 2 != 0:
			print('YES')
			b.pop()
			b.append(i - 1 + subtract)
			c = a + b
			print(*c)
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	ans = [0] * n
	even = 2
	mid = n // 2
	for i in range(0, n // 2, 2):
		ans[i] = even
		ans[i + 1] = even + 2
		ans[i + mid] = even - 1
		ans[i + 1 + mid] = even + 3
		even += 6
	for x in ans:
		print(x, end=' ')
	print()


import math
for w in range(int(input())):
	x = int(input())
	if x / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		lista = [(i + 1) * 2 for i in range(int(x / 2))]
		soma = sum(lista)
		cont = 1
		for i in range(int(x / 2), x):
			lista.append(cont)
			soma -= cont
			cont += 2
		lista[-1] += soma
		for i in range(len(lista) - 1):
			print(lista[i], end=' ')
		print(lista[-1])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = []
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			a.append(i * 2)
		for i in range(1, n // 2):
			a.append(i * 2 - 1)
		a.append(a[n // 2 - 1] + n // 2 - 1)
		print(*a)


test = int(input())
for t in range(test):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		l = []
		j = 2
		for i in range(n // 2):
			l.append(j)
			j += 2
		k = 0
		z = 0
		for i in range(n // 2 - 1):
			l.append(l[k] - 1)
			z += 1
			k += 1
		l.append(l[k] + z)
		for i in range(len(l)):
			print(str(l[i]) + ' ', end='')
		print()
	else:
		print('NO')


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(T):
	(n, k) = map(int, lines[2 * t + 1].strip().split(' '))
	nums = list(map(int, lines[2 * t + 2].strip().split(' ')))
	noChange = {}
	oneChange = {}
	for i in range(2, 2 * k + 4):
		noChange[i] = 0
		oneChange[i] = 0
	for i in range(n // 2):
		l = nums[i]
		r = nums[-i - 1]
		noChange[l + r] += 1
		oneChange[min(l, r) + 1] += 1
		oneChange[l + r] -= 1
		oneChange[l + r + 1] += 1
		oneChange[max(l, r) + k + 1] -= 1
	for i in range(3, 2 * k + 4):
		oneChange[i] += oneChange[i - 1]
	res = n
	for i in range(2, 2 * k + 3):
		tmp = n - oneChange[i] - 2 * noChange[i]
		res = min(tmp, res)
	print(res)


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		e = [2]
		o = [1]
		for i in range(1, n // 2):
			e.append(e[-1] + 2)
		for i in range(1, n // 2 - 1):
			o.append(o[-1] + 2)
		o.append(sum(e) - sum(o))
		print(*e, end=' ')
		print(*o)


t = int(input())
for test in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		k = 0
		for i in range(n // 2):
			k += 2
			ans.append(k)
		s = (2 + k) // 2 * n // 2
		k = 1
		for i in range(n // 2 - 1):
			ans.append(k)
			s -= k
			k += 2
		ans.append(s)
		print(*ans)


numbs = int(input())
for n in range(numbs):
	word = int(input())
	if word / 2 % 2 == 0:
		a = []
		for n in range(1, word + 1):
			if n % 2 == 0:
				a.append(n)
		for n in range(1, word):
			if n % 2 != 0:
				a.append(n)
		a[word - 1] = int(a[word - 1] + word / 2)
		print('YES')
		for x in range(word):
			a[x] = str(a[x])
		print(' '.join(a))
	else:
		print('NO')


from sys import stdin
input = stdin.readline
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	n //= 2
	if n & 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n + 1):
		print(i * 2, end=' ')
	for i in range(1, n):
		print(i * 2 - 1, end=' ')
	print(3 * n - 1)


t = int(input())
for e in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		x = []
		y = []
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				x.append(i)
			else:
				y.append(i)
		y[n // 2 - 1] = y[n // 2 - 1] + n // 2
		for i in x:
			print(int(i), end=' ')
		for i in y:
			print(int(i), end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		li = [int(i) for i in range(1, n + 1) if i % 2 == 0]
		x = int(n / 4 * 6)
		c = 0
		for i in range(1, x):
			if i % 2 != 0 and c < n / 2 - 1:
				li.append(i)
				c += 1
		li.append(x - 1)
		for i in li:
			print(i, end=' ')
		print()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [0 for x in range(2 * k + 1)]
	for i in range(n // 2):
		b[0] += 2
		b[2 * k] += -2
		x = min(a[i], a[n - 1 - i])
		y = max(a[i], a[n - 1 - i])
		b[x] += -1
		b[y + k] += 1
		b[x + y - 1] += -1
		b[x + y] += 1
	mini = int(2000000000.0)
	minidx = -1
	sumi = 0
	for i in range(0, 2 * k):
		sumi += b[i]
		if sumi < mini:
			mini = sumi
			minidx = i
	print(mini)


def generateArray(n):
	half = n // 2
	ans = []
	sum_ = 0
	(even, odd) = (2, 1)
	for i in range(half):
		ans.append(even)
		sum_ += even
		even += 2
	for i in range(half - 1):
		ans.append(odd)
		sum_ -= odd
		odd += 2
	if sum_ & 1 == 1:
		ans.append(sum_)
		sum_ = 0
	return [ans, sum_ == 0]
t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 & 1 == 1:
		print('NO')
	else:
		(arr, poss) = generateArray(n)
		if poss:
			print('YES')
			for (idx, i) in enumerate(arr):
				if idx != len(arr):
					print(i, end=' ')
				else:
					print(i)
		else:
			print('NO')


def main():
	for _ in range(int(input())):
		n = int(input())
		b = [0] * (n + 1)
		j = 1
		o = n
		sumo = 0
		sume = 0
		num = 1
		if n // 2 % 2 == 0:
			print('YES')
			for i in range(1, n + 1):
				if i % 2 == 0:
					b[j] = i
					sume += i
					j += 1
				else:
					b[o] = i
					sumo += i
					o -= 1
			if sumo != sume:
				dif = abs(sumo - sume)
				b[n // 2 + 1] = b[n // 2 + 1] + dif
			for i in range(1, n + 1):
				print(b[i], end=' ')
			print()
		else:
			print('NO')
main()


a = int(input())
for i in range(a):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(1, n // 2 + 1):
			l.append(2 * i)
		k = len(l)
		for i in range(len(l) - 1):
			l.append(2 * i + 1)
		l.append(l[len(l) // 2] + k - 1)
		for i in l:
			print(i, end=' ')
		print('')


t = int(input())
for _ in range(t):
	n = int(input())
	pairs = n // 2
	if pairs % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
	array = []
	for i in range(n):
		if i < pairs:
			array.append(2 * (i + 1))
		else:
			j = i - pairs
			array.append(2 * j + 1 if j != pairs - 1 else 2 * j + 1 + pairs)
	print(' '.join(map(str, array)))


T = int(input())
for _ in range(T):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		b = []
		for i in range(int(n / 4)):
			a.append(2 * i + 1)
			b.append(2 * i + 2)
		for i in range(int(n / 4), int(n / 2)):
			a.append(2 * i + 3)
			b.append(2 * i + 2)
		for i in b:
			print(i, end=' ')
		for i in a:
			print(i, end=' ')
		print()


t = int(input())

def Balance(n):
	if n % 4 != 0:
		return 'NO'
	l = str(2)
	for i in range(4, n + 2, 2):
		l += ' ' + str(i)
	for j in range(1, n - 1, 2):
		l += ' ' + str(j)
	l += ' ' + str(n - 1 + n // 2)
	print('YES')
	return l
for _ in range(t):
	n = int(input())
	print(Balance(n))


even = list()
odd = list()
t = input()
t = int(t)
for i in range(t):
	n = input()
	n = int(n)
	if n % 2 == 0:
		halfarray = int(n / 2)
		if halfarray % 2 == 0:
			print('YES')
			a = 2
			for i in range(1, halfarray + 1):
				even.append(a * i)
			ev = 0
			od = 0
			for j in range(halfarray):
				if j % 2 == 0:
					aa = even[ev] - 1
					ev += 1
					odd.append(aa)
				else:
					kk = halfarray - ev
					aa = even[kk] + 1
					odd.append(aa)
			for ev in even:
				print(ev, ' ', end='')
			for od in odd:
				print(od, ' ', end='')
		else:
			print('NO')
		odd.clear()
		even.clear()
	else:
		print('NO')


T = int(input())
while T:
	T -= 1
	N = int(input())
	x = N // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		m = []
		for i in range(2, N + 1, 2):
			l.append(i)
		temp = sum(l)
		for i in range(len(l) - 1):
			m.append(l[i] - 1)
		m.append(abs(temp - sum(m)))
		for i in l:
			print(i, end=' ')
		for j in m:
			print(j, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	half = n // 2
	if half % 2 == 1:
		print('NO')
		continue
	total = sum((2 * x for x in range(1, half + 1)))
	remain = total - sum((2 * x - 1 for x in range(1, half)))
	print('YES')
	print(*(2 * x for x in range(1, half + 1)), end=' ')
	print(*(2 * x - 1 for x in range(1, half)), remain)


output = []
for __ in range(int(input())):
	N = int(input())
	if N % 4 != 0:
		output.append('NO')
	else:
		x = list(range(2, N // 2 * 2 + 1, 2))
		y = []
		for i in x[0:N // 4]:
			y.append(i - 1)
		for i in x[N // 4:]:
			y.append(i + 1)
		x = x + y
		x = [str(num) for num in x]
		output.append('YES')
		output.append(' '.join(x))
for o in output:
	print(o)


from collections import Counter, defaultdict, deque
import heapq as hq
from itertools import count, islice
import math
import sys
input = sys.stdin.readline
tt = int(input())
for test in range(tt):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	print('YES')
	for i in range(1, n // 2 + 1):
		print(2 * i, end=' ')
	for i in range(1, n // 2):
		print(2 * i - 1, end=' ')
	print(n - 1 + n // 2)


t = int(input())
while t:
	(n, k) = map(int, input().rstrip().split())
	a = list(map(int, input().rstrip().split()))
	p = [0 for i in range(2 * k + 2)]
	f = p.copy()
	for i in range(n // 2):
		f[a[i] + a[n - i - 1]] += 1
		p[min(a[i], a[n - i - 1]) + 1] += 1
		p[max(a[i], a[n - i - 1]) + k + 1] -= 1
	s = 0
	for i in range(len(p)):
		s += p[i]
		p[i] = s
	ans = float('inf')
	for i in range(2, 2 * k + 1):
		ans = min(ans, p[i] - f[i] + (n // 2 - p[i]) * 2)
	print(ans)
	t -= 1


def func(n):
	if n % 4 != 0:
		print('NO')
		return
	arr1 = []
	arr2 = []
	for i in range(1, n // 2 + 1):
		arr1.append(i * 4)
	for j in range(len(arr1)):
		if j % 2 == 0:
			arr2.append(arr1[j] - 1)
		else:
			arr2.append(arr1[j] + 1)
	print('YES')
	print(*arr1, end=' ')
	print(*arr2, end=' ')
	print()
t = int(input())
for i in range(t):
	n = int(input())
	func(n)


for _ in range(int(input())):
	n = int(input())
	noofodd = n // 2
	se = 0
	so = 0
	if noofodd % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(noofodd):
			print(2 * (i + 1), end=' ')
			se += 2 * (i + 1)
		for i in range(noofodd - 1):
			print(2 * (i + 1) - 1, end=' ')
			so += 2 * (i + 1) - 1
		print(se - so)


t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		a = []
		for i in range(2, n + 1, 2):
			a.append(i)
		even_sum = sum(a)
		odd_sum = 0
		for i in range(len(a)):
			a.append(a[i] - 1)
			odd_sum += a[i] - 1
		a[-1] += even_sum - odd_sum
		print('YES')
		for ele in a:
			print(ele, end=' ')
		print()
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	OUT = [n // 2] * (2 * k + 2)
	extraL = [0] * (2 * k + 2)
	extraR = [0] * (2 * k + 2)
	for i in range(n // 2):
		left = l[i]
		right = l[n - 1 - i]
		OUT[left + right] -= 1
		extraL[min(left, right)] += 1
		extraR[max(left, right) + k + 1] += 1
	curr = 0
	for i in range(2 * k + 2):
		curr += extraR[i]
		extraR[i] = curr
	curr = 0
	for i in range(2 * k + 1, -1, -1):
		curr += extraL[i]
		extraL[i] = curr
	for i in range(2 * k + 2):
		OUT[i] += extraL[i] + extraR[i]
	print(min(OUT))


import sys

def func():
	n = int(sys.stdin.readline())
	if n % 4 != 0:
		return False
	arr = []
	for i in range(2, n + 1, 2):
		arr.append(i)
	for j in range(1, n, 2):
		arr.append(j)
	arr[n - 1] = arr[n - 1] + n // 2
	return arr
t = int(sys.stdin.readline())
while t:
	n = func()
	if n == False:
		print('NO')
	else:
		print('YES')
		for i in n:
			print(i, end=' ')
		print()
	t -= 1


def fun(n):
	if n % 4 == 2:
		print('NO')
		return
	print('YES')
	ans = [0] * n
	temp = 2
	sume = 0
	sumo = 0
	for i in range(n // 2):
		ans[i] = temp
		sume += temp
		temp += 2
	temp = 1
	for i in range(n // 2, n - 1):
		ans[i] = temp
		sumo += temp
		temp += 2
	ans[n - 1] = sume - sumo
	for i in range(0, n):
		print(ans[i], end=' ')
	print()
t = int(input())
for i in range(t):
	n = int(input())
	fun(n)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	s = 0
	sum_ = 0
	for j in range(n // 2):
		s += 2
		sum_ += s
		print(s, end=' ')
	st = 1
	for j in range(n // 2 - 1):
		print(st, end=' ')
		sum_ -= st
		st += 2
	print(sum_)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = []
	b = []
	c = []
	d = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				a.append(str(i))
				c.append(i)
		for i in range(1, n - 1):
			if i % 2 != 0:
				b.append(str(i))
				d.append(i)
		b.append(str(sum(c) - sum(d)))
		k = a + b
		print(' '.join(k))


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		s = []
		x = 2
		y = 1
		i = 0
		while i < n / 2:
			s.append(x)
			x += 2
			i += 1
		while i < n - 1:
			s.append(y)
			y += 2
			i += 1
		s.append(int(y + n / 2))
		for i in s:
			print(i, end=' ')
		print()


testCount = int(input())
for _ in range(testCount):
	n = int(input())
	n //= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		answer = []
		for i in range(n):
			answer.append(2 * i + 2)
		for i in range(n - 1):
			answer.append(2 * i + 1)
		answer.append(1 + 2 * (n - 1) + n)
		print(*answer)


def inti():
	return int(input())
T = inti()
for t in range(1, T + 1):
	N = inti()
	if N % 4 != 0:
		print('NO')
		continue
	n = N // 2
	s1 = ''
	s2 = ''
	for i in range(1, N + 1):
		if i % 2 == 0:
			s1 += str(i) + ' '
		elif i < N - 1:
			s2 += str(i) + ' '
	s2 += str(N + n - 1)
	s1 += s2
	print('YES')
	print(s1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	odd = 2 * (n / 2) - 1
	if (odd + int(n / 2) + 2) % 2 == 0:
		print('NO')
	else:
		print('YES')
		ans = [i for i in range(2, n + 1, 2)]
		ans.extend([i for i in range(1, n - 1, 2)])
		ans.append(int(n / 2 + ans[-1] + 2))
		for a in ans:
			print(a, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	kp = int(n / 2)
	sp = []
	tp = []
	if kp % 2 != 0:
		print('NO')
	else:
		print('YES')
		for k in range(int(n // 2)):
			sp.append(2 * (k + 1))
			tp.append(2 * (k + 1) - 1)
		tp[kp - 1] += kp
		print(*sp, sep=' ', end=' ')
		print(*tp, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2:
		print('NO')
		continue
	print('YES')
	left = 0
	for i in range(n // 2):
		print((i + 1) * 2, end=' ')
		left += (i + 1) * 2
	right = 0
	for i in range(n // 2 - 1):
		print((i + 1) * 2 - 1, end=' ')
		right += (i + 1) * 2 - 1
	print(left - right)


from sys import stdin

def solve(n, k, a):
	d = {}
	m = [0 for i in range(2 * k + 5)]
	for i in range(n // 2):
		l = min(a[i], a[n - i - 1])
		r = max(a[i], a[n - i - 1])
		m[l + 1] += 1
		m[r + k + 1] -= 1
		p = l + r
		d[p] = d[p] + 1 if p in d else 1
	for j in range(1, len(m)):
		m[j] += m[j - 1]
	ans = n // 2
	for j in range(2, 2 * k + 1):
		f = d[j] if j in d else 0
		ans = min(ans, m[j] - f + 2 * (n // 2 - m[j]))
	print(ans)

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		(n, k) = map(int, inp().split())
		a = list(map(int, inp().split()))
		solve(n, k, a)
main()


def read():
	return list(map(lambda x: int(x), input().split()))
T = read()[0]
for t in range(T):
	n = read()[0]
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(n // 2):
			print(i * 2 + 2, end=' ')
		for i in range(n // 2 - 1):
			print(i * 2 + 1, end=' ')
		print(n + (n // 2 - 1))


n = int(input())
for k in range(n):
	n1 = int(input())
	if n1 % 4 == 2:
		print('NO')
	if n1 % 4 == 0:
		print('YES')
		a = [0] * n1
		sum = 0
		for i in range(n1 // 2):
			a[i] = 2 * i + 2
			sum += 2 * i + 2
		for i in range(n1 // 2, n1 - 1):
			a[i] = 2 * (i - n1 // 2) + 1
			sum -= 2 * (i - n1 // 2) + 1
		a[n1 - 1] = sum
		for j in range(n1):
			print(a[j], end=' ')
		print('')


t = int(input())
for a in range(t):
	n = int(input())
	if n % 4 == 0:
		answer = ''
		total = 0
		for b in range(1, n // 2 + 1):
			answer += str(b * 2) + ' '
			total += b * 2
		oddTotal = 0
		for b in range(n // 2 - 1):
			answer += str(b * 2 + 1) + ' '
			oddTotal += b * 2 + 1
		answer += str(total - oddTotal)
		print('YES')
		print(answer)
	else:
		print('NO')


num = int(input())
for i in range(num):
	arg = int(input())
	if arg % 4 != 0:
		print('NO')
	else:
		print('YES')
		s = int(arg / 2)
		arr = []
		for i in range(1, s + 1):
			arr.append(str(2 * i))
		for i in range(1, s):
			arr.append(str(2 * i - 1))
		arr.append(str(3 * s - 1))
		print(' '.join(arr))


for _ in range(int(input())):
	n = int(input())
	temp = n // 2
	if temp % 2 != 0:
		print('NO')
	else:
		print('YES')
		data = []
		for q in range(temp):
			data.append(2 + 2 * q)
		for q in range(temp - 1):
			data.append(1 + 2 * q)
		ans = sum(data[:temp]) - sum(data[temp:])
		data.append(ans)
		for q in data:
			print(q, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n & 2 == 2:
		print('NO')
	else:
		print('YES')
		ret = []
		for m in range(2, n + 1, 2):
			ret.append(m)
		for m in range(1, n - 1, 2):
			ret.append(m)
		ret.append(3 * n // 2 - 1)
		print(' '.join(map(str, ret)))


for i in range(int(input())):
	n = int(input())
	a = n // 2
	b = []
	o = []
	d = []
	if n % 4 == 0:
		print('YES')
		for i in range(1, a + 1):
			b.append(i * 2)
		for i in range(1, n - 1, 2):
			o.append(i)
		ans = sum(b) - sum(o)
		print(*b, *o, ans)
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		arr = []
		for i in range(1, n // 2 + 1):
			arr.append(2 * i)
		for i in range(1, n // 2):
			arr.append(2 * i - 1)
		arr.append(sum(arr[:n // 2]) - sum(arr[n // 2:]))
		for i in range(n):
			arr[i] = str(arr[i])
		print(' '.join(arr))
	else:
		print('NO')


import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = []
	s1 = 0
	s2 = 0
	for i in range(1, n // 2 + 1):
		a.append(i * 2)
		s1 = s1 + i * 2
	for j in range(1, n // 2):
		a.append(j * 2 - 1)
		s2 = s2 + j * 2 - 1
	if (s1 - s2) % 2 == 1 and s1 - s2 != 1:
		a.append(s1 - s2)
		s2 = s1
	if s1 == s2:
		print('YES')
		for w in a:
			print(w, end=' ')
		print('')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		k = n // 2
		l1 = []
		num = 2
		for i in range(k // 2):
			l1.append(num)
			l1.append(num + 2)
			num += 6
		l2 = []
		for i in range(0, n // 2 - 1, 2):
			l2.append(l1[i] - 1)
			l2.append(l1[i + 1] + 1)
		print('YES')
		for el in l1:
			print(el, end=' ')
		for el in l2:
			print(el, end=' ')
		print()


for _ in [0] * int(input()):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	l_arr = [x for x in range(2, n + 1, 2)]
	r_arr = [x for x in range(1, n, 2)]
	r_arr[-1] += sum(l_arr) - sum(r_arr)
	print(*l_arr, *r_arr)


import sys
input = sys.stdin.readline
out = sys.stdout
from collections import defaultdict
import bisect
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	d = defaultdict(int)
	maxis = []
	minis = []
	for i in range(n // 2):
		minis.append(min(a[i], a[n - i - 1]))
		maxis.append(max(a[i], a[n - i - 1]))
		d[a[i] + a[n - i - 1]] += 1
	minis.sort()
	maxis.sort()
	ans = 200000
	for x in range(2, 2 * k + 1):
		temp = 0
		if x <= k:
			ind = bisect.bisect_left(minis, x)
			temp = 2 * (n // 2 - ind) + ind - d[x]
		elif x > k:
			t = x - k
			ind = bisect.bisect_left(maxis, t)
			temp = n // 2 - ind + 2 * ind - d[x]
		ans = min(ans, temp)
	out.write(str(ans) + '\n')


import sys, math, cmath, time
start_time = time.time()

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

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

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

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

def solve():
	n = inp()
	if n % 4 == 0:
		q = [-4]
		for i in range(n // 2):
			if i % 2 != 0:
				q.append(q[-1] + 2)
			else:
				q.append(q[-1] + 6)
		q.pop(0)
		for i in range(n // 2):
			if i % 2 != 0:
				q.append(q[-n // 2] + 1)
			else:
				q.append(q[-n // 2] - 1)
		print('YES')
		print(*q)
	else:
		print('NO')
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
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 solve(n, k, a):
	reps = [0] * (2 * k + 2)
	bs = [0] * (2 * k + 2)
	es = [0] * (2 * k + 2)
	for i in range(n // 2):
		s = min(a[i], a[n - i - 1])
		l = max(a[i], a[n - i - 1])
		reps[s + l] -= 1
		bs[s + 1] += 1
		es[k + l + 1] += 1
	accu = n
	for i in range(2 * k + 2):
		accu -= bs[i] - es[i]
		reps[i] += accu
	print(min(reps))
t = int(input())
args = []
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	args.append((n, k, a))
for (n, k, a) in args:
	solve(n, k, a)


import math
from decimal import *
getcontext().prec = 30
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	l = [0] * (2 * k + 2)
	for i in range(n // 2):
		l[1] += 2
		l[2 * k + 1] -= 2
		mini = min(a[i], a[n - 1 - i]) + 1
		maxi = max(a[i], a[n - 1 - i]) + k
		sum = a[i] + a[n - 1 - i]
		l[mini] += -1
		l[maxi + 1] += 1
		l[sum] += -1
		l[sum + 1] += 1
	ans = 10 ** 10
	for i in range(2, 2 * k + 1):
		l[i] += l[i - 1]
		ans = min(ans, l[i])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 2:
		print('NO')
	else:
		print('YES')
		k = n // 4
		ans = []
		for i in range(1, 2 * k + 1):
			ans.append(2 * i)
		for i in range(1, 2 * k):
			ans.append(2 * i - 1)
		ans.append(6 * k - 1)
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	p = n
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		m = 0
		l1 = []
		l2 = []
		for j in range(1, int(n / 2) + 1):
			m = 2 * j
			l1.append(m)
		for k in range(int(n / 2) - 1):
			m = l1[k] - 1
			l2.append(m)
		l2.append(sum(l1) - sum(l2))
		l1.extend(l2)
		for q in l1:
			print(q, end=' ')


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	n //= 2
	s_even = n * (n + 1)
	s_odd_minus_one = (n - 1) ** 2
	last_odd_number = s_even - s_odd_minus_one
	print(' '.join([str(2 * i) for i in range(1, n + 1)]), end=' ')
	print(' '.join([str(2 * i - 1) for i in range(1, n)]), end=' ')
	print(last_odd_number)


import math
t = int(input())
for x in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = [2 * i for i in range(1, n // 2 + 1)]
		for i in range(n // 2 - 1):
			temp = l[i]
			l.append(temp - 1)
		temp = l[n // 2 - 1]
		l.append(temp + n // 2 - 1)
		print('YES')
		for i in l:
			print(i, end=' ')
		print()


def sol(n):
	mid = n // 2
	l1 = [2 * i for i in range(1, mid + 1)]
	sum1 = sum(l1)
	l2 = [2 * j - 1 for j in range(1, mid)]
	sum2 = sum(l2)
	diff = sum1 - sum2
	if diff % 2 == 0:
		return ('NO', None)
	else:
		l2.append(diff)
		l1.extend(l2)
		return ('YES', ' '.join(map(str, l1)))
for _ in range(int(input())):
	n = int(input())
	(a, b) = sol(n)
	print(a)
	if b is not None:
		print(b)


n = int(input())
for _ in range(n):
	leng = int(input())
	if leng % 2 == 0 and leng // 2 % 2 != 0:
		print('NO')
		continue
	else:
		print('YES')
		ans = []
		for i in range(1, leng + 1):
			if i % 2 == 0:
				ans.append(str(i))
		for i in range(leng + 1, 0, -1):
			if i % 2 != 0 and i != leng // 2 + 1:
				ans.append(str(i))
		print(' '.join(ans))


t = int(input())
check = 0
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		ans = []
		numc = 2
		numc1 = 1
		s1 = 0
		s = 0
		for j in range(n // 2):
			s += numc
			ans.append(numc)
			numc += 2
		for j in range(n // 2):
			if j != n // 2 - 1:
				s1 += numc1
			ans.append(numc1)
			numc1 += 2
		ans[-1] = int(n + n // 2 - 1)
		print('YES')
		print(*ans)
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	lis = []
	if n / 2 % 2 == 0:
		print('yes')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for j in range(2, n + 1, 2):
			if j <= n // 2:
				print(j - 1, end=' ')
			elif j == n:
				print(j + 1)
			else:
				print(j + 1, end=' ')
	else:
		print('no')


n_cases = int(input())
for case_num in range(n_cases):
	n = int(input())
	m = n // 2
	if m % 2 != 0:
		print('NO')
		continue
	print('YES')
	for i in range(1, m + 1):
		print('{} '.format(2 * i), end='')
	for i in range(m - 1):
		print('{} '.format(2 * i + 1), end='')
	print('{}'.format(2 * (m - 1) + m + 1))


import math
import sys
from collections import defaultdict
from collections import Counter
from collections import deque
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)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
for _ in range(int(input())):
	N = int(input())
	x = N // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		s = 0
		t = 0
		for i in range(1, x + 1):
			a = 2 * i
			print(a, end=' ')
			s += a
		for j in range(x - 1):
			b = 2 * j + 1
			print(b, end=' ')
			t += b
		print(s - t, end=' ')
		print()


def main():
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('Yes')
		for i in range(n // 2):
			print(i + i + 2, end=' ')
		for i in range(n // 2 - 1):
			print(i + i + 1, end=' ')
		print(n + n // 2 - 1)
	return ''
n = int(input())
for i in range(n):
	print(main())


num = int(input(''))
for i in range(num):
	arrayLength = int(input(''))
	if not arrayLength % 4 == 0:
		print('NO')
	else:
		printList = []
		for j in range(0, int(arrayLength / 2)):
			printList.append(2 * (j + 1))
		for k in range(0, int(arrayLength / 4)):
			printList.append(2 * (k + 1) - 1)
		for n in range(int(3 / 4 * arrayLength), arrayLength):
			printList.append(2 * (n + 1) - (arrayLength - 1))
		print('YES')
		for u in printList:
			print(u, end=' ')


t = int(input())
for tc in range(t):
	n = int(input())
	half = n // 2
	if half % 2 != 0:
		print('NO')
		continue
	a = []
	evens = 0
	for i in range(1, half + 1):
		evens += 2 * i
		a.append(2 * i)
	odds = 0
	for i in range(1, half):
		odds += 2 * i - 1
		a.append(2 * i - 1)
	a.append(evens - odds)
	print('YES')
	print(' '.join(map(str, a)))


t = int(input())
for q in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		arr = [0] * (n // 2)
		mass = [0] * (n // 2)
		for i in range(1, n // 2 + 1):
			arr[i - 1] = i * 2
		for i in range(n // 4):
			mass[i] = arr[i] - 1
		for i in range(n // 4):
			mass[i + n // 4] = arr[i + n // 4] + 1
		arr = arr + mass
		print(*arr)
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	print(*range(2, n + 1, 2), end=' ')
	print(*range(1, n - 1, 2), end=' ')
	print((n >> 1) + n - 1)


test = int(input())
while test > 0:
	n = int(input())
	check = n // 2 % 2
	sum = 0
	if check == 0:
		print('YES')
		total = 0
		total2 = 0
		list1 = list((i * 2 for i in range(1, n // 2 + 1)))
		list2 = list((j * 2 + 1 for j in range(0, n // 2 - 1)))
		for k in list1:
			total = total + k
		for a in list2:
			total2 = total2 + a
			list1.append(a)
		list1.append(total - total2)
		print(' '.join((str(x) for x in list1)))
	else:
		print('NO')
	test = test - 1


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)), end=' ')
t = ii()
for _ in range(t):
	n = ii()
	div = n // 2
	if div % 2 == 0:
		print('YES')
		(par, impar) = ([], [])
		for i in range(1, n + 1):
			if i % 2 == 0:
				par.append(i)
			else:
				impar.append(i)
		impar[-1] += len(par)
		print_array(par)
		print_array(impar)
		print()
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = int(input())
	if a // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = []
		s = []
		p = 2
		q = 1
		for j in range(a // 2):
			print(p, end=' ')
			p = p + 2
		for j in range(a // 2 - 1):
			print(q, end=' ')
			q = q + 2
		print(q + a // 2, end=' ')
		print()


for test in range(int(input())):
	n = int(input())
	if n % 4 == 0 and 3 * (n // 2) - 1 <= 1000000000:
		print('YES')
		print(*(num for num in range(2, n + 2, 2)), sep=' ', end=' ')
		print(*(num for num in range(1, n - 1, 2)), sep=' ', end=' ')
		print(3 * (n // 2) - 1)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n & 1 or n // 2 & 1:
		print('NO')
	else:
		ls = []
		lf = []
		for i in range(n):
			if i & 1:
				lf.append(1000000 + i)
			else:
				ls.append(1000000 + i)
		lf[0] -= n // 2
		print('YES')
		print(*ls, *lf)


import math

def solve():
	n = int(input())
	if n % 2 == 1:
		print('NO')
	else:
		v = n // 2
		if v % 2 == 1:
			print('NO')
		else:
			l1 = []
			sum1 = 0
			sum2 = 0
			c = 2
			for i in range(v):
				l1.append(c)
				sum1 += c
				c = c + 2
			c = 1
			for i in range(v):
				if i == v - 1:
					l1.append(sum1 - sum2)
				else:
					l1.append(c)
					sum2 += c
					c = c + 2
			print('YES')
			print(*l1)
for _ in range(int(input())):
	solve()


for x in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		b = 0
		while b < n / 2:
			print(2 + 2 * b, end=' ')
			b += 1
		b = 0
		c = 0
		while b < n / 2:
			c = n / 2 + b
			if b == n / 2 - 1:
				print(int(n / 2 + 2 * b + 1), end=' ')
				b += 1
			else:
				print(1 + 2 * b, end=' ')
				b += 1
	else:
		print()
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		sum = 0
		even = 2
		for j in range(n // 2):
			sum += even
			print(even, end=' ')
			even += 2
		odd = 1
		sum2 = 0
		for j in range(n // 2 - 1):
			sum2 += odd
			print(odd, end=' ')
			odd += 2
		print(sum - sum2)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n // 2 % 2:
			print('NO')
		else:
			print('YES')
			k = n // 2
			A = [2 * x for x in range(1, k + 1)]
			B = [2 * x + 1 for x in range(k - 1)]
			l = sum(A) - sum(B)
			Ans = A + B + [l]
			print(*Ans)
main()


import sys
import math

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

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

def bfs(graph1, root1):
	visited1 = set()
	queue1 = [[root1, 0]]
	visited1.add(root1)
	(qw, ver) = (0, 1)
	while queue1:
		vertex1 = queue1[0]
		queue1 = queue1[1:]
		for neig1 in graph1[vertex1[0]]:
			if neig1 not in visited1:
				visited1.add(neig1)
				queue1 += [[neig1, vertex1[1] + 1]]
				if qw < vertex1[1] + 1:
					(ver, qw) = (neig1, vertex1[1] + 1)
	return (ver, qw)

def dfs(graph, ver):
	used_v = set()
	depth = [0] * (len(graph) + 1)
	level = [ver]
	num_of_level = 0
	while level:
		new_level = []
		for v in level:
			depth[v] = num_of_level
			used_v.add(v)
			for v1 in graph[v]:
				if v1 not in used_v:
					new_level += [v1]
		level = new_level
		num_of_level += 1
	return depth

def binary_search(array, x):
	(left, right) = (-1, len(array))
	while left + 1 != right:
		middle = (left + right) // 2
		if array[middle] >= x:
			right = middle
		elif array[middle] < x:
			left = middle
	return right

def c_mod(n1, k1, mod1):
	num = den = 1
	for i in range(n1 - k1):
		num = num * (n1 - i) % mod1
		den = den * (i + 1) % mod1
	return num * pow(den, mod1 - 2, mod1) % mod1

def c(n1, k1):
	num = den = 1
	for i in range(n1 - k1):
		num = num * (n1 - i)
		den = den * (i + 1)
	return num // den

def v_sistemu(x, k):
	x = int(x)
	z = ''
	while x:
		z += str(x % k)
		x //= k
	return z[::-1]

def iz_sistemi(x, k):
	x = str(x)[::-1]
	ans = 0
	for i in range(len(x)):
		ans += int(x[i]) * pow(k, i)
	return ans

def solve_of_problem():
	n = int(ii())
	if n % 4:
		print('NO')
	else:
		print('YES')
		(a, b) = ([], [])
		for i in range(n // 2):
			a += [(i + 1) * 2]
			b += [i * 2 + 1]
		b[-1] += n // 2
		print(*a, *b, sep=' ')
	return
for ______ in range(int(ii())):
	solve_of_problem()


import sys, re
from collections import deque, defaultdict, Counter
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])
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	t = INT()
	while t != 0:
		n = INT()
		if n // 2 % 2 == 0:
			ans = []
			for i in range(1, n // 2 + 1):
				ans.append(2 * i)
			cnt = 1
			toadd = 1
			summ = 0
			while cnt <= n // 2 - 2:
				ans.append(toadd)
				summ += toadd
				toadd += 2
				cnt += 1
			foo = n * (n + 2) // 4
			half = foo - summ
			if half // 2 % 2 == 0:
				ans.append(half // 2 - 1)
				ans.append(half // 2 + 1)
			else:
				ans.append(half // 2 - 2)
				ans.append(half // 2 + 2)
			print('YES')
			if summ == 0:
				ans = [2, 4, 1, 5]
			print(*ans)
		else:
			print('NO')
		t -= 1
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 == 0:
		l = [x for x in range(2, n + 1, 2)]
		k = [x for x in range(1, n, 2)]
		k[-1] += int(n / 2)
		print('YES')
		for i in l:
			print(i, end=' ')
		for i in k:
			print(i, end=' ')
		print(end='\n')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = []
		a = 2
		n = n // 2
		for i in range(n):
			l.append(a)
			a += 2
		i = 0
		j = n - 1
		p = []
		while i < j:
			p.append(l[i] - 1)
			p.append(l[j] + 1)
			i += 1
			j -= 1
		l.extend(p)
		print('YES')
		for i in l:
			print(i, end=' ')
		print()
	t -= 1


import math
loop_time = int(input())
for time in range(0, loop_time):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		array = []
		for ii in range(0, int(n / 2)):
			array.append((ii + 1) * 2)
		for jj in range(0, int(n / 2 - 1)):
			array.append((jj + 1) * 2 - 1)
		array.append(3 * n / 2 - 1)
		for ele in array:
			print(int(ele), end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	print('YES')
	even = [i for i in range(2, n + 1, 2)]
	odd = [i for i in range(1, n - 1, 2)] + [n + n // 2 - 1]
	print(*even, end=' ')
	print(*odd)


T = int(input())
for t in range(T):
	N = int(input())
	if N % 4 != 0:
		print('NO')
		continue
	print('YES')
	res = []
	for i in range(N // 4):
		res.append((i + 1) * 6 - 4)
		res.append((i + 1) * 6 - 2)
	for i in range(N // 4):
		res.append((i + 1) * 6 - 5)
		res.append((i + 1) * 6 - 1)
	print(' '.join([str(i) for i in res]))


import sys
import math
import bisect

def solve(n):
	n //= 2
	A = []
	B = []
	for i in range(n):
		A.append((i + 1) * 2)
	for i in range(n):
		B.append(i * 2 + 1)
	B[-1] += sum(A) - sum(B)
	if B[-1] % 2 == 0:
		return (False, [])
	return (True, A + B)

def main():
	for _ in range(int(input())):
		n = int(input())
		ans = solve(n)
		if ans[0]:
			print('YES')
			print(' '.join((str(a) for a in ans[1])))
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = [0] * n
		for i in range(n):
			if i < int(n / 2):
				a[i] = (i + 1) * 2
				a[int(n / 2) + i] = a[i] - 1
		a[n - 1] = 3 * int(n / 2) - 1
		string = ''
		for i in range(n):
			string += str(a[i]) + ' '
		print(string)
	else:
		print('NO')


cnt = int(input())

def summ(f, l, k):
	return (f + l) * k // 2
for _ in range(cnt):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		n2 = n // 2
		s1 = summ(2, n2 * 2, n2)
		s2 = summ(1, n2 * 2 - 3, n2 - 1)
		r = []
		for i in range(1, n2 + 1):
			r.append(i * 2)
		for i in range(1, n2):
			r.append(i * 2 - 1)
		r.append(s1 - s2)
		print('YES')
		print(' '.join(map(str, r)))


from sys import stdin, stdout

def f(n):
	if int(n / 2) % 2 == 1:
		print('NO')
		return
	a = []
	k = 0
	c = 2
	for i in range(int(n / 2)):
		k += c
		a.append(c)
		c += 2
	j = 0
	c = 1
	for i in range(int(n / 2) - 1):
		a.append(c)
		j += c
		c += 2
	a.append(k - j)
	print('YES')
	print(*a)
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	f(n)


for tc in range(int(input())):
	n = int(input())
	x = n * (n + 1)
	x //= 2
	if x % 2:
		print('NO')
		continue
	else:
		ans = []
		x = n // 2
		i = 2
		xx = 0
		yy = 0
		while x:
			ans.append(i)
			xx += i
			i += 2
			x -= 1
		x = n // 2 - 1
		i = 1
		while x:
			ans.append(i)
			yy += i
			i += 2
			x -= 1
		ans.append(abs(yy - xx))
		print('YES')
		print(*ans)


n = int(input())
s = []
for i in range(n):
	(t, u, v) = ([], [], [])
	a = int(input())
	x = int(a / 2)
	if x % 2 != 0:
		s.append('NO')
	else:
		s.append('YES')
		for j in range(1, x + 1):
			t.append(2 * j)
		y = sum(t)
		for k in range(x - 1):
			u.append(2 * k + 1)
		z = sum(u)
		b = y - z
		v.extend(t)
		v.extend(u)
		v.append(b)
		for l in range(a):
			v[l] = str(v[l])
		s.append(v)
for m in range(len(s)):
	if s[m] == 'NO':
		print(s[m])
	elif s[m] == 'YES':
		print(s[m])
		print(' '.join(s[m + 1]))


k = list(map(int, input().split()))
t = k[0]
for i in range(t):
	n = list(map(int, input().split()))
	n = n[0]
	if n % 4 == 0:
		print('YES')
		l1 = [str((ob + 1) * 2) for ob in range(n // 2)]
		l2 = [str((ob + 1) * 2 - 1) for ob in range(n // 2)]
		l = l1 + l2
		l[-1] = str(int(l[-1]) + n // 2)
		print(' '.join(l))
	else:
		print('NO')


def thearray(n):
	evens = [x for x in range(2, n + 1, 2)]
	odds = [x - 1 for x in evens]
	odds.pop()
	odds.append(sum(evens) - sum(odds))
	full = evens + odds
	return full
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		ta = ' '.join(map(str, thearray(n)))
		print(ta)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = ''
	si = 0
	sio = 0
	h = n // 2 % 2
	h1 = n // 2
	if h == 1:
		print('NO')
	else:
		print('YES')
		tmp = 2
		tmp_odd = 1
		for x in range(h1):
			s += str(tmp) + ' '
			si += tmp
			tmp += 2
		for x in range(h1 - 1):
			s += str(tmp_odd) + ' '
			sio += tmp_odd
			tmp_odd += 2
		s += str(si - sio)
		print(s)


t = int(input())
while t > 0:
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		k = n // 2
		x = [x for x in range(2, k * 2 + 1, 2)]
		y = [x for x in range(1, k * 2 - 1, 2)]
		last = [sum(x) - sum(y)]
		x = x + y + last
		for i in x:
			print(i, end=' ')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	if n % 4 == 0:
		print('YES')
		i = 2
		while i <= n:
			arr.append(i)
			print(i, end=' ')
			i += 2
		sum1 = sum(arr)
		i = 1
		while i < n - 1:
			arr.append(i)
			print(i, end=' ')
			i += 2
		sum2 = sum(arr[len(arr) // 2 + 1:len(arr)])
		print(sum1 - sum2)
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	a = []
	b = []
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		half = int(n / 2)
		a = [x * 2 for x in range(1, half + 1)]
		b = [x * 2 - 1 for x in range(1, half)]
		even_sum = half * (half + 1)
		odd_sum = math.floor(pow(half - 1, 2))
		a.extend(b)
		a.append(even_sum - odd_sum)
		print(' '.join(map(str, a)))
	else:
		print('NO')


a = int(input())
for c in range(a):
	d = int(input())
	if d % 4 != 0:
		print('NO')
	else:
		print('YES')
		i = [str(x) for x in range(2, d + 1, 2)]
		j = [str(x) for x in range(1, d, 2)]
		j[-1] = str(int(j[-2]) + 2 * (d // 4 + 1))
		l = i + j
		print(' '.join(l))


t = int(input())
for it in range(t):
	n = int(input())
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		print('YES')
		L_even = []
		L_odd = []
		sum_even = 0
		sum_odd = 0
		for i in range(1, k + 1):
			L_even.append(2 * i)
			sum_even += 2 * i
			if i < k:
				L_odd.append(2 * i - 1)
				sum_odd += 2 * i - 1
		L_odd.append(sum_even - sum_odd)
		for i in range(k):
			print(L_even[i], end=' ')
		for i in range(k):
			print(L_odd[i], end=' ')
		print('')


from collections import Counter
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = []
	u = [0] * (2 * k + 2)
	for i in range(n // 2):
		u[min(a[i], a[-i - 1]) + 1] += 1
		u[max(a[i], a[-i - 1]) + k + 1] -= 1
		s.append(a[i] + a[-i - 1])
	for i in range(1, 2 * k + 2):
		u[i] += u[i - 1]
	c = Counter(s)
	ans = 10 ** 9
	for i in range(2, 2 * k + 1):
		if i in c:
			ans = min(ans, u[i] - c[i] + (n // 2 - u[i]) * 2)
		else:
			ans = min(ans, u[i] + (n // 2 - u[i]) * 2)
	print(ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	div = int(n / 2)
	if div % 2 == 0:
		print('YES')
		a = [0] * n
		cnt = 2
		sum_even = int(n / 2 * (n / 2 + 1))
		for i in range(int(n / 2)):
			a[i] = cnt
			cnt += 2
		cnt = 1
		sum_odd = int((n / 2 - 1) ** 2)
		for i in range(int(n / 2), n):
			a[i] = cnt
			cnt += 2
		a[n - 1] = int(sum_even - sum_odd)
		print(*a)
	else:
		print('NO')


kl = int(input())
for l in range(kl):
	n = int(input())
	k = n // 2
	if k % 2 != 0:
		print('NO')
	else:
		a = [1 + 2 * int(i) for i in range(k)]
		b = [2 * int(i) for i in range(1, k + 1)]
		a[k - 1] = a[k - 1] + k
		rz = b + a
		print('YES')
		print(*rz)


for _ in range(int(input())):
	x = int(input())
	temp = x // 2
	ev = 2
	odd = 1
	wtf = -1
	if temp % 2 == 0:
		print('YES')
		for i in range(x):
			if i < temp:
				print(ev, end=' ')
				ev += 2
			elif i >= temp and i != x - 1:
				print(odd, end=' ')
				wtf = odd
				odd += 2
			else:
				print(wtf + temp // 2 * 2 + 2, end=' ')
		print('')
	else:
		print('NO')


from sys import stdin, stdout
m = 10 ** 9 + 7
t = int(stdin.readline())
while t:
	t -= 1
	(n, k) = map(int, stdin.readline().split())
	l = [int(i) for i in stdin.readline().split()]
	x = [0 for i in range(0, 2 * k + 2)]
	for i in range(0, int(n / 2)):
		x[1] += 2
		x[2 * k + 1] -= 2
		left = min(l[i], l[n - i - 1]) + 1
		right = max(l[i], l[n - i - 1]) + k
		x[left] -= 1
		x[right + 1] += 1
		x[l[i] + l[n - i - 1]] -= 1
		x[l[i] + l[n - i - 1] + 1] += 1
	for i in range(1, len(x)):
		x[i] = x[i] + x[i - 1]
	stdout.write(str(min(x[2:-1])) + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = []
		for j in range(1, int(n / 2) + 1):
			app = 2 * j
			a.append(app)
		sumii = sum(a)
		for j in range(1, int(n / 2)):
			app = 2 * j - 1
			a.append(app)
		sumi = sum(a)
		diff = 2 * sumii - sumi
		a.append(diff)
		for z in range(0, len(a) - 1):
			print(a[z], end=' ')
		print(a[len(a) - 1])


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = [0]
		for i in range(n // 2):
			l.append(l[-1] + 2)
			print(l[i + 1], end=' ')
		for i in range(n // 2):
			if i == n // 2 - 1:
				print(l[i + 1] + n // 2 - 1, end=' ')
			else:
				print(l[i + 1] - 1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	check = n // 2
	if check % 2 == 1:
		print('NO')
	else:
		result = []
		even = 0
		for i in range(check):
			even = even + 2
			result.append(even)
		result.append(1)
		odd = 1
		for _ in range(check - 1):
			odd = odd + 2
			result.append(odd)
		result[n - 1] = result[n - 1] + check
		print('YES')
		print(*result)


n = int(input())
for i in range(n):
	t = int(input())
	if int(t // 2) % 2 != 0:
		print('NO')
	else:
		print('YES')
		f = 2
		s = 0
		for i in range(int(t // 2)):
			print(f, end=' ')
			s += f
			f = f + 2
		f = 1
		q = 0
		for i in range(int(t // 2) - 1):
			print(f, end=' ')
			q += f
			f += 2
		print(s - q)


for _ in range(int(input())):
	n = int(input())
	t = n // 2
	if t % 2:
		print('NO')
		continue
	i = 0
	l1 = [t for t in range(2, n + 1, 2)]
	l2 = [t for t in range(1, n + 1, 2)]
	print('YES')
	n = len(l2)
	l2[n - 1] = sum(l1) - sum(l2[:-1])
	print(*l1, *l2, sep=' ')


for _ in range(int(input())):
	n = int(input())
	lst = [0] * n
	even = 2
	for i in range(n // 2):
		lst[i] = even
		even += 2
	odd = 1
	for j in range(n // 2, n):
		lst[j] = odd
		odd += 2
	diff = abs(sum(lst[n // 2:n]) - sum(lst[0:n // 2]))
	if diff % 2 == 0:
		lst[-1] += diff
		print('YES')
		print(*lst)
	else:
		print('NO')


import bisect
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	ans = n // 2
	maxes = [0] * ans
	mines = [0] * ans
	summes = []
	count_summes = {}
	for i in range(n // 2):
		count_summes[a[i] + a[n - i - 1]] = 0
	for i in range(n // 2):
		maxes[i] = max(a[i], a[n - i - 1])
		mines[i] = min(a[i], a[n - i - 1])
		summes.append(a[i] + a[n - i - 1])
		count_summes[a[i] + a[n - i - 1]] += 1
	maxes.sort()
	mines.sort()
	for i in range(len(summes)):
		ans_now = 0
		s_now = summes[i]
		max_s = s_now - k
		min_s = s_now - 1
		first = 2 * (n // 2 - bisect.bisect_right(mines, min_s))
		second = 2 * bisect.bisect_left(maxes, max_s)
		ost = n // 2 - first // 2 - second // 2 - count_summes[s_now]
		ans = min(ans, ost + first + second)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		arr = ''
		eSum = 0
		oSum = 0
		for j in range(n // 2):
			arr += str((j + 1) * 2) + ' '
			eSum += (j + 1) * 2
		for j in range(n // 2 - 1):
			arr += str((j + 1) * 2 - 1) + ' '
			oSum += (j + 1) * 2 - 1
		arr += str(eSum - oSum) + ' '
		print(arr)


def solve(n, k, ls):
	ans = n
	sums = []
	constant = [0] * (2 * k + 1)
	for i in range(int(n / 2)):
		s = ls[i] + ls[n - i - 1]
		constant[s] += 1
	minmax = [0] * (2 * k + 1)
	for i in range(int(n / 2)):
		a = ls[i]
		b = ls[n - i - 1]
		min_sum = min(a, b) + 1
		max_sum = max(a, b) + k
		minmax[min_sum] += 1
		if max_sum == 2 * k:
			continue
		minmax[max_sum + 1] -= 1
	for i in range(1, 2 * k + 1):
		minmax[i] += minmax[i - 1]
	for x in range(2, 2 * k + 1):
		ans = min(ans, minmax[x] - constant[x] + (int(n / 2) - minmax[x]) * 2)
	return ans
no = int(input())
for i in range(no):
	(n, k) = tuple(map(int, input().strip().split()))
	ls = list(map(int, input().strip().split()))
	print(solve(n, k, ls))


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		for i in range(1, round(n / 2) + 1):
			a.append(2 * i)
		b = []
		for i in range(round(n / 4)):
			b.append(a[i] - 1)
		for i in range(round(n / 4), round(n / 2)):
			b.append(a[i] + 1)
		for i in range(round(n / 2)):
			print(a[i], end=' ')
		for i in range(round(n / 2)):
			print(b[i], end=' ')
		print()


t = int(input())
p = []
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		r = 'NO'
	else:
		total1 = 0
		total2 = 0
		q = []
		r = 'YES'
		for j in range(1, n + 1):
			if j % 2 == 0:
				total1 = total1 + j
				q.append(j)
		for k in range(1, n - 2):
			if k % 2 != 0:
				total2 = total2 + k
				q.append(k)
		g = total1 - total2
		q.append(g)
		sarr = [str(a) for a in q]
		o = ' '.join(sarr)
	p.append(r)
	if r == 'YES':
		p.append(o)
for item in p:
	print(item)


import math
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = [0 for i in range(2 * k + 1)]
	for i in range(n // 2):
		s[a[i] + a[n - i - 1]] += 1
	p = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		lb = min(a[i], a[n - i - 1]) + 1
		ub = max(a[i], a[n - i - 1]) + k
		p[lb] += 1
		p[ub + 1] -= 1
	for i in range(1, 2 * k + 1):
		p[i] += p[i - 1]
	ans = n
	for x in range(2, 2 * k + 1):
		ans = min(ans, p[x] - s[x] + (n // 2 - p[x]) * 2)
	print(ans)


def check_sum(n, k):
	sum_before_k = (k - 1) ** 2
	if n > sum_before_k:
		max_last_dig = n - sum_before_k
		if max_last_dig % 2 == 1 and max_last_dig >= 2 * k - 1:
			result = []
			start = 1
			while sum_before_k:
				sum_before_k -= start
				result.append(start)
				start += 2
			return result + [max_last_dig]
t = int(input())
result = []
for _ in range(t):
	n = int(input())
	if n / 2 % 2:
		result.append('NO')
	else:
		result.append('YES')
		array = []
		check = int(n / 2)
		step = 1
		while check:
			array.append(2 * step)
			check -= 1
			step += 1
		sum_array = sum(array)
		array += check_sum(sum_array, int(n / 2))
		result.append(array)
for res in result:
	if res == 'NO' or res == 'YES':
		print(res)
	else:
		print(' '.join(map(str, res)))


def balanced_array(n):
	f = []
	s = []
	for i in range(n // 4):
		f.append((n + 2) // 2 - 2 * i - 2)
		f.append((n + 2) // 2 + 2 * i + 2)
		s.append((n + 2) // 2 + 2 * i + 1)
		s.append((n + 2) // 2 - 2 * i - 1)
	return s + f

def test():
	number_of_tests = int(input())
	for i in range(number_of_tests):
		n = int(input())
		if n % 4 == 0:
			output1 = 'YES'
			balancedarray = balanced_array(n)
			output2 = ' '.join(map(str, balancedarray))
			print(output1)
			print(output2)
		else:
			print('NO')
	return ()
test()


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		halfSum1 = 0
		halfSum2 = 0
		for i in range(n // 2):
			a.append(2 * (i + 1))
			halfSum1 += 2 * (i + 1)
		for i in range(n // 2 - 1):
			a.append(2 * i + 1)
			halfSum2 += 2 * i + 1
		a.append(halfSum1 - halfSum2)
		for x in a:
			print(x, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	nums = list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [int(n / 2 + n - 1)]
	print(' '.join(map(str, nums)))


t = int(input())
for _ in range(t):
	k = int(input())
	n = k // 2
	if n % 2 != 0:
		print('NO')
	else:
		print('YES')
		l1 = [x for x in range(2, k + 1, 2)]
		l2 = [x for x in range(1, k - 2, 2)]
		for i in l1:
			print(i, end=' ')
		for j in l2:
			print(j, end=' ')
		print(sum(l1) - sum(l2), end=' ')
		print()


t = int(input())
par = []
impar = []
for i in range(t):
	n = int(input())
	if n < 4:
		print('NO')
	else:
		for i in range(int(n / 2)):
			par.append(2 * (i + 1))
			impar.append(2 * (i + 1) - 1)
		del impar[-1]
		novo = sum(par) - sum(impar)
		if novo % 2 == 0:
			print('NO')
		else:
			impar.append(novo)
			if sum(par) == sum(impar):
				par.extend(impar)
				print('YES')
				print(*par, sep=' ')
			else:
				print('NO')
	par = []
	impar = []


test = int(input())
sol = []
while test:
	test -= 1
	n = int(input())
	if n // 2 & 1:
		sol.append('NO')
	else:
		d = ['YES', []]
		s = 0
		for i in range(n // 2):
			s += (i + 1) * 2
			d[1].append((i + 1) * 2)
		for i in range(n // 2):
			d[1].append(2 * i + 1)
			s -= 2 * i + 1
		d[1][n - 1] += s
		sol.append(d)
for i in sol:
	if i == 'NO':
		print(i)
	else:
		print(i[0])
		print(*i[1])


n = int(input())
n1 = 1
while n1 <= n:
	m = int(input())
	x = m // 2
	if x % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = 1
		b = 2
		k1 = 0
		k2 = 0
		l = []
		for i in range(x):
			k1 = k1 + b
			l.append(str(b))
			b = b + 2
		for i in range(x - 1):
			k2 = k2 + a
			l.append(str(a))
			a = a + 2
		l.append(str(k1 - k2))
		s = ' '.join(l)
		print(s)
	n1 = n1 + 1


t = int(input())
for i in range(0, t):
	n = int(input())
	l = []
	e = 0
	o = -1
	se = 0
	so = 0
	for j in range(0, int(n / 2)):
		e = e + 2
		l.append(e)
		se += e
	for j in range(1, int(n / 2)):
		o = o + 2
		l.append(o)
		so += o
	if (se - so) % 2 != 0:
		l.append(se - so)
		print('YES')
		for j in l:
			print(j, end=' ')
	else:
		print('NO')


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	if n / 2 % 2:
		res.append(False)
	else:
		half = int(n / 2)
		temp = [2 * x for x in range(1, half + 1)] + [2 * x - 1 for x in range(1, half + 1)]
		temp[-1] += half
		res.append(temp)
for r in res:
	if not r:
		print('NO')
	else:
		print('YES')
		for j in r:
			print(j, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		c = n // 2
		evens = list(range(2, c * 2 + 2, 2))
		odds = list(range(1, c * 2 - 1, 2))
		odds.append(sum(evens) - sum(odds))
		print(' '.join((str(n) for n in (*evens, *odds))))


for _ in range(int(input())):
	n = int(input())
	l = []
	if n % 4 != 0:
		print('NO')
	else:
		for i in range(n // 2):
			l.append(2 * (i + 1))
		x = sum(l)
		z = n // 2
		j = 1
		s = 0
		k = []
		while s < x:
			a = 2 * j - 1
			s = s + a
			j = j + 1
			k.append(a)
		print('YES')
		q = sum(k) - x
		k.remove(q)
		l = l + k
		print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		s = []
		u = []
		for i in range(2, n + 1, 2):
			s.append(i)
		x = sum(s)
		t = 1
		for j in range(n // 2 - 1):
			u.append(t)
			t += 2
		y = sum(u)
		s = s + u
		s.append(x - y)
		print('YES')
		print(' '.join((str(x) for x in s)))


import sys
input = sys.stdin.readline
inf = int(1000000000.0)
for i in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	(l, r) = (0, n - 1)
	psum = [0] * (2 * k + 2)
	while l < r:
		s = arr[l] + arr[r]
		lb = min(arr[l], arr[r]) + 1
		rb = max(arr[l], arr[r]) + k
		psum[lb] += 1
		psum[rb + 1] -= 1
		psum[s] += 1
		psum[s + 1] -= 1
		l += 1
		r -= 1
	ans = 0
	for i in range(2, 2 * k + 1):
		psum[i] += psum[i - 1]
		ans = max(ans, psum[i])
	print(n - ans)


t = int(input())
for i in range(t):
	a = 0
	s = 1
	s2 = 0
	s3 = 0
	t = 1
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		for j in range(n - 1):
			if j < n // 2:
				a += 2
				s2 += a
				print(a, end=' ')
			else:
				print(s, end=' ')
				s3 += s
				s += 2
		print(s2 - s3)


t = int(input())
for i in range(t):
	n = int(input())
	c = int(n / 2)
	if c % 2 == 1:
		print('no')
	else:
		print('yes')
		r1 = 0
		for j in range(1, c + 1):
			print(2 * j, '')
			r1 += 2 * j
		r2 = 0
		for k in range(1, c):
			print(2 * k - 1)
			r2 += 2 * k - 1
		print(r1 - r2)


def findNumbers(n):
	nums = []
	l = n // 2
	ne = 2
	s = 0
	no = 1
	for i in range(l):
		nums.append(ne)
		s += ne
		ne += 2
	for i in range(l - 1):
		nums.append(no)
		s -= no
		no += 2
	nums.append(s)
	return nums
t = int(input())
while t > 0:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		nums = findNumbers(n)
		print('YES')
		print(*nums)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	n >>= 1
	if n & 1:
		print('NO')
	else:
		print('YES')
		x = [2 * (i + 1) for i in range(n)]
		for i in range(n):
			x.append(2 * i + 1)
		x[-1] += n
		print(*x)


t = int(input())
for w in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		odd = []
		even = []
		c = 0
		for i in range(n // 4):
			even.append(c + 2)
			even.append(c + 4)
			odd.append(c + 1)
			odd.append(c + 5)
			c += 10
		for i in range(n // 2):
			print(even[i], end=' ')
		for i in range(n // 2):
			print(odd[i], end=' ')
		print()


def solve():
	T = int(input())
	while T > 0:
		nk = input().split()
		a = list(map(int, input().split()))
		n = int(nk[0])
		k = int(nk[1])
		result = 10 ** 9
		mn = [0 for _ in range(2 * k + 1)]
		mx = [0 for _ in range(2 * k + 1)]
		cnt = [0 for _ in range(2 * k + 1)]
		x = [0 for _ in range(2 * k + 1)]
		x[0] = 0
		x[1] = 0
		for i in range(n // 2):
			sum = a[i] + a[n - i - 1]
			cnt[sum] += 1
			cur_mn = min(a[i] + 1, a[n - i - 1] + 1)
			cur_mx = max(a[i] + k, a[n - i - 1] + k)
			mn[cur_mn] += 1
			mx[cur_mx] += 1
		for i in range(2, 2 * k + 1):
			x[i] = x[i - 1] + (mn[i] - mx[i - 1])
			y = n / 2 - x[i]
			total = x[i] + 2 * y - cnt[i]
			result = min(result, total)
		print(int(result))
		T -= 1
solve()


for i in range(int(input())):
	n = int(input())
	ans = 'NO'
	s = ''
	if n % 2 == 0:
		if n // 2 % 2 == 0:
			ans = 'YES'
			even = list(range(2, n + 1, 2))
			odd = list(range(1, n - 1, 2))
			odd.append(even[-1] + n // 2 - 1)
			s = even + odd
	print(ans)
	if ans == 'YES':
		print(' '.join([str(x) for x in s]))
		s = ''


for test in range(int(input())):
	(n, k) = map(int, input().split())
	a = [*map(int, input().split())]
	breakdown = [(a[i], a[n - 1 - i]) for i in range(n // 2) if not (a[i] > k and a[n - 1 - i] > k)]
	update = n - 2 * len(breakdown)
	score = [0 for value in range(2 * k + 2)]
	for pair in breakdown:
		(a, b) = pair
		if a <= k and b <= k:
			score[2] += 2
			score[min(a, b) + 1] -= 1
			score[max(a, b) + k + 1] += 1
			score[a + b] -= 1
			score[a + b + 1] += 1
		elif a >= k:
			score[2] += 2
			score[b + 1] -= 1
			score[b + k + 1] += 1
		elif b >= k:
			score[2] += 2
			score[a + 1] -= 1
			score[a + k + 1] += 1
	control = 0
	minimum = n
	for key in score[2:2 * k + 1]:
		control += key
		minimum = min(minimum, control)
	print(update + minimum)


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2:
		print('NO')
	else:
		print('YES')
		n //= 2
		cnt = 2
		for i in range(n):
			print(cnt, end=' ')
			cnt += 2
		sum = n * (n + 1)
		cnt = 1
		for i in range(n - 1):
			print(cnt, end=' ')
			sum -= cnt
			cnt += 2
		print(sum)


for _ in range(int(input())):
	n = int(input())
	a = []
	last = None
	s = ''
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a.append(2)
		sum1 = 2
		for i in range(1, int(n / 2)):
			a.append(int(a[i - 1] + 2))
		sum1 = sum(a)
		a.append(1)
		sum2 = 1
		for i in range(int(n / 2) + 1, int(n - 1)):
			a.append(a[i - 1] + 2)
		sum2 = sum(a)
		last = int(2 * sum1 - sum2)
		a.append(last)
		print(*a)


a = int(input())
for i in range(a):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		l = 0
		cv = 0
		m = []
		asw = 0
		for i in range(n // 2):
			l += 2
			cv += l
			print(l, end=' ')
			if i != n // 2 - 1:
				m.append(str(l - 1))
			else:
				asw = l
		m.append(str(asw + (n // 2 - 1)))
		print(' '.join(m))
	else:
		print('NO')


for _ in range(int(input())):
	l1 = []
	l2 = []
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(n // 2):
			if len(l1) == 0:
				l1.append(1)
				l2.append(2)
				flag = 1
			else:
				x = l1[-1]
				l1.append(x + 4)
				if flag == 1:
					l2.append(l1[-1] - 1)
					flag = 0
				else:
					l2.append(l1[-1] + 1)
					flag = 1
		print(*l2 + l1)
	else:
		print('NO')


t = int(input())
lstx = []
for i in range(t):
	n = int(input())
	k = 0
	lstp = []
	for i in range(1, n + 1):
		if i % 2 == 0:
			lstp.append(i)
	for i in range(n):
		if i % 2 == 1:
			lstp.append(i)
	lstp[len(lstp) - 1] += n // 2
	if lstp[len(lstp) - 1] % 2 == 0:
		lstx.append('NO')
	else:
		lstx.append(['YES', lstp])
for i in range(len(lstx)):
	if lstx[i] == 'NO':
		print(lstx[i])
	if lstx[i][0] == 'YES':
		print('YES')
		for i in lstx[i][1]:
			print(i, end=' ')
		print()


t = int(input())
for j in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		l = list((2 * i for i in range(1, n // 2 + 1)))
		l1 = []
		k = 1
		for i in range(n // 2 - 1):
			l1.append(k)
			k += 2
		y = sum(l) - sum(l1)
		l1.append(y)
		print('YES')
		for k in l + l1:
			print(k, end=' ')
		print()


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

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

def STR():
	return input()

def MAP():
	return map(int, input().split())
for _ in range(INT()):
	n = INT()
	even = [2]
	odd = [1]
	cnteven = 4
	cntodd = 3
	ans = []
	if int(n / 2) & 1:
		NO()
	else:
		YES()
		for i in range(int(n / 2) - 1):
			even.append(cnteven)
			if len(odd) < int(n / 2 - 1):
				odd.append(cntodd)
			cnteven += 2
			cntodd += 2
		odd.append(sum(even) - sum(odd))
		ans = even + odd
		for i in range(len(ans)):
			print(ans[i], end=' ')
		print('')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		m = n // 2
		a = []
		b = []
		(sa, sb) = (0, 0)
		for j in range(2, n + 1, 2):
			if j % 2 == 0:
				a.append(j)
				sa += j
				if j != n:
					b.append(j - 1)
					sb += j - 1
		print(*a, *b, sa - sb)


for _ in range(int(input())):
	n = int(input())
	a = []
	c = 1
	x = 2
	s1 = 0
	while c <= n // 2:
		a.append(x)
		s1 += x
		x += 2
		c += 1
	y = 1
	(s2, c) = (0, 1)
	while c < n // 2:
		a.append(y)
		c += 1
		s2 += y
		y += 2
	odd = y
	flag = True
	while True:
		if odd + s2 == s1:
			print('YES')
			print(' '.join(map(str, a)) + ' ' + str(odd))
			break
		elif odd + s2 > s1:
			flag = False
			break
		else:
			odd += 2
	if not flag:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a1 = []
	a2 = []
	num = 0
	for i in range(int(n / 2) - 1):
		num += 2
		a1.append(num)
		a2.append(num - 1)
	a1.append(num + 2)
	if (sum(a1) - sum(a2)) % 2 != 0:
		a2.append(sum(a1) - sum(a2))
		print('YES')
		print(*a1, *a2)
	else:
		print('NO')


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

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

def iinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		ans = []
		s = 0
		i = 2
		for kk in range(n // 2):
			ans.append(i)
			s += i
			i += 2
		s1 = 0
		i = 1
		for kk in range(n // 2 - 1):
			ans.append(i)
			s1 += i
			i += 2
		ans.append(s - s1)
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	tmp = n // 2
	if tmp % 2 == 1:
		print('NO')
	else:
		ans = [0] * n
		tmp_sum1 = 0
		tmp_sum2 = 0
		for i in range(tmp):
			ans[i] = (i + 1) * 2
			tmp_sum1 += (i + 1) * 2
		for i in range(tmp, n - 1):
			ans[i] = (i - tmp) * 2 + 1
			tmp_sum2 += (i - tmp) * 2 + 1
		ans[n - 1] = tmp_sum1 - tmp_sum2
		print('YES')
		print(' '.join(list(map(str, ans))))


T = int(input())
a = [0] * 200005
while T != 0:
	T = T - 1
	n = int(input())
	if n % 4 == 0:
		print('YES')
		t = n * 2 + 2
		len = n // 2
		j = 2
		for i in range(1, len // 2 + 1):
			a[i] = j
			a[len - i + 1] = t - j
			j = j + 2
		j = 1
		for i in range(len + 1, len + 1 + len // 2):
			a[i] = j
			a[n - i + 1 + len] = t - j
			j = j + 2
		for i in range(1, n + 1):
			print(a[i], end=' ')
		print()
	else:
		print('NO')


zz = int(input())
for nnnnnn in range(zz):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		n = n // 2
		print('YES')
		for i in range(1, n + 1):
			print(i * 2, end=' ')
		for i in range(1, n):
			print(i * 2 - 1, end=' ')
		ppp = 3 * n - 1
		print(ppp)


n = int(input())
for _ in range(n):
	k = int(input())
	a = []
	mid = k // 2
	s = 0
	i = 2
	while len(a) + 1 <= mid:
		a.append(i)
		s += i
		i += 2
	i = 1
	while len(a) + 2 <= k:
		a.append(i)
		s -= i
		i += 2
	if s & 1 == 1:
		a.append(s)
		print('YES')
		print(*a)
	else:
		print('NO')


T = int(input())
for _ in range(T):
	N = int(input())
	if N // 2 % 2 != 0:
		print('NO')
	else:
		evenlist = []
		x = 2
		for i in range(N // 2):
			evenlist.append(x)
			x = x + 2
		evensum = sum(evenlist)
		oddlist = []
		x = 1
		for i in range(N // 2 - 1):
			oddlist.append(x)
			x = x + 2
		last = evensum - sum(oddlist)
		oddlist.append(last)
		print('YES')
		print(*evenlist, sep=' ', end=' ')
		print(*oddlist, sep=' ')


n = int(input())
out = []
for i in range(n):
	inp = int(input())
	if inp % 4 != 0:
		out.append('NO')
	else:
		out.append('YES')
		temp = []
		j = 1
		for k in range(0, int(inp / 2)):
			temp.append(2 * j)
			j += 1
		l = 1
		for k in range(int(inp / 2), inp):
			temp.append(2 * l - 1)
			l += 1
		temp[-1] += inp / 2
		int(temp[-1])
		out.append(temp)
for i in range(len(out)):
	if out[i] == 'YES':
		print('YES')
		for j in range(len(out[i + 1])):
			if j == len(out[i + 1]) - 1:
				print(int(out[i + 1][j]))
			else:
				print(out[i + 1][j], end=' ')
	if out[i] == 'NO':
		print('NO')


for i in range(int(input())):
	inp = int(input())
	su = 0
	s2 = 0
	if inp // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		c = 1
		for j in range(2, 100000000000000, 2):
			c += 1
			print(j, end=' ')
			su += j
			if c == inp // 2 + 1:
				break
		for j in range(1, 10000000000000000, 2):
			c += 1
			print(j, end=' ')
			s2 += j
			if c == inp:
				break
		print(su - s2)


from math import sqrt

def genre_even_odd(n, diff):
	ans = []
	for i in range(1, n + 1):
		ans.append(2 * i)
	for i in range(0, n):
		ans.append(2 * i + 1)
	ans[-1] += diff
	return ans

def main():
	t = int(input())
	for __ in range(t):
		n = int(input()) // 2
		even_sum = n * (n + 1)
		pos_n = int(sqrt(even_sum))
		diff = even_sum - pos_n ** 2
		if diff % 2:
			print('NO')
		else:
			print('YES')
			print(*genre_even_odd(n, diff))
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	L = list(map(int, input().split()))
	size = 2 * k + 1
	count = [0] * size
	ans = [0] * size
	(i, j) = (0, n - 1)
	while i < j:
		count[L[i] + L[j]] += 1
		i += 1
		j -= 1
	(i, j) = (0, n - 1)
	while i < j:
		(a, b) = (L[i], L[j])
		ans[min(a, b) + 1] += 1
		try:
			ans[max(a, b) + k + 1] -= 1
		except IndexError:
			pass
		i += 1
		j -= 1
	for i in range(2, size):
		ans[i] += ans[i - 1]
	for i in range(2, size):
		ans[i] -= count[i]
	for i in range(2, size):
		ans[i] += 2 * (n // 2 - (count[i] + ans[i]))
	print(min(ans[2:]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = [int(x) for x in input().split()]
	fr = [0] * (2 * k + 1)
	for i in range(n // 2):
		sm = ar[i] + ar[n - i - 1]
		fr[sm] += 1
	pre = [0] * (2 * k + 10)
	for i in range(n // 2):
		mn = min(ar[i], ar[n - i - 1]) + 1
		mx = max(ar[i], ar[n - i - 1]) + k
		pre[mn] += 1
		pre[mx + 1] -= 1
	for i in range(1, 2 * k + 10):
		pre[i] += pre[i - 1]
	ans = 2 * n
	for i in range(2, 2 * k + 1):
		ans = min(ans, pre[i] - fr[i] + (n // 2 - pre[i]) * 2)
	print(ans)


import sys

def solve():
	(n, k) = [int(x) for x in input().split()]
	li = [int(x) for x in input().split()]
	zero_changes = [0] * (2 * k + 1)
	for i in range(n // 2):
		zero_changes[li[i] + li[n - i - 1]] += 1
	one_changes = [0] * (2 * k + 2)
	for i in range(n // 2):
		maxp = max(li[i], li[n - i - 1]) + k
		minp = min(li[i], li[n - i - 1]) + 1
		one_changes[minp] += 1
		one_changes[maxp + 1] -= 1
	for i in range(3, 2 * k + 1):
		one_changes[i] += one_changes[i - 1]
	minm = sys.maxsize
	for i in range(2, 2 * k + 1):
		zero = zero_changes[i]
		one = one_changes[i] - zero
		two = n // 2 - one - zero
		total_cost = 2 * two + 1 * one + 0 * zero
		minm = min(minm, total_cost)
	print(minm)
t = int(input())
for i in range(t):
	solve()


tc = int(input(''))
while tc >= 1:
	a = int(input(''))
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		t = a / 2
		s = 1
		p = 1
		while s <= t:
			k = 2 * s
			print(k, end=' ')
			s = s + 1
		while p <= t - 1:
			l = int(int(2 * p) - 1)
			print(l, end=' ')
			p = p + 1
		print(int(k + t - 1))
	tc = tc - 1


for _ in range(int(input())):
	n = int(input())
	k = n // 2
	c = -1
	if k & 1:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			c += 1
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(k * (k + 1) - c * c)


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
t = int(input())
while t:
	n = int(input())
	if n == 2 or n // 2 % 2 == 1:
		print('NO')
	else:
		se = 0
		so = 0
		res = []
		a = 2
		for i in range(n // 2):
			res.append(a)
			se += a
			a += 2
		a = 1
		for i in range(n // 2 - 1):
			res.append(a)
			so += a
			a += 2
		res.append(se - so)
		print('YES')
		print(*res)
	t -= 1


from math import *
for zz in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		cs = 0
		ce = 2
		for i in range(n // 2):
			a.append(ce)
			cs += ce
			ce += 2
		ce = 1
		for i in range(n // 2, n - 1):
			a.append(ce)
			cs -= ce
			ce += 2
		a.append(cs)
		print(*a)


t = int(input())
while t > 0:
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = list(range(2, n + 2, 2)) + list(range(1, 2 * (int(n / 2) - 1) + 1, 2)) + [n + int(n / 2) - 1]
		print(*a, sep=' ')
	t = t - 1


t = int(input())
for _t in range(t):
	(n, k) = map(int, input().strip().split())
	a = [int(x) for x in input().split()]
	(ref, intvls) = (dict(), [])
	for i in range(n // 2):
		x = a[i] + a[n - i - 1]
		ref[x] = ref.get(x, 0) + 1
		intvls += [(min(a[i], a[n - i - 1]) + 1, max(a[i], a[n - i - 1]) + k)]
	ff = [0] * 2 * (k + 1)
	for (i, j) in intvls:
		ff[i] += 1
		ff[j + 1] += -1
	ans = 10 ** 9
	for i in range(2, 2 * k + 1):
		ff[i] += ff[i - 1]
		(no_of_0s, no_of_1s) = (ref.get(i, 0), ff[i] - ref.get(i, 0))
		no_of_2s = n // 2 - no_of_1s - no_of_0s
		ans = min(ans, no_of_2s * 2 + no_of_1s * 1 + no_of_0s * 0)
	print(ans)


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


t = int(input())
for j in range(t):
	n = int(input())
	d = 0
	r = 0
	if n % 4 == 0:
		print('YES')
		for i in range(n + 1):
			if i % 2 == 0 and i > 0:
				print(i, end=' ')
				d += i
		for i in range(n - 1):
			if i % 2 == 1 and i > 0:
				print(i, end=' ')
				r += i
		print(d - r)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		output = []
		for i in range(n // 2):
			output.append(2 * i + 2)
		total = sum(output)
		for i in range(n // 2):
			if i == n // 2 - 1:
				output.append(total)
			else:
				output.append(2 * i + 1)
				total -= 2 * i + 1
		print('YES')
		print(*output)
	else:
		print('NO')


def inp():
	return int(input())
t = inp()
nu = []
for i in range(0, t):
	nu.append(inp())
for n in nu:
	r = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(n / 2 + 1)):
			r.append(i * 2)
		for i in range(1, int(n / 2)):
			r.append(i * 2 - 1)
		r.append(int(n / 2 * (4 + (n / 2 - 1) * 2) / 2 - (n / 2 - 1) * (2 + (n / 2 - 2) * 2) / 2))
		print(*r, sep=' ')


rw = int(input())
for ewqr in range(rw):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	a = []
	for i in range(2, n + 1, 2):
		a.append(i)
	for i in range(1, n, 2):
		a.append(i)
	a[n - 1] += n // 2
	for i in a:
		print(i, end=' ')
	print('')


for t in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		a = []
		j = 2
		s1 = 0
		for i in range(n // 2):
			a.append(j)
			j += 2
			s1 += j
		j = 1
		s2 = 0
		for i in range(n // 2 - 1):
			a.append(j)
			j += 2
			s2 += j
		a.append(s1 - s2 - 2)
		print(*a)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	b = {}
	flag = 0
	flag1 = 0
	c = [0 for i in range(2 * k + 2)]
	while i < n // 2:
		if b.get(a[i] + a[j]) == None:
			b[a[i] + a[j]] = 1
		else:
			b[a[i] + a[j]] += 1
		c[min(a[i], a[j]) + 1] += 1
		c[max(a[i], a[j]) + k + 1] -= 1
		i += 1
		j -= 1
	for i in range(3, 2 * k + 1):
		c[i] += c[i - 1]
	mi = n
	for i in range(2, 2 * k + 1):
		d = 0
		if b.get(i) != None:
			d = b[i]
		e = c[i] - d
		f = n // 2 - (e + d)
		mi = min(mi, e + 2 * f)
	print(mi)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('Yes')
		a = [i for i in range(2, n + 1, 2)]
		s = 0
		for i in range(1, n - 2, 2):
			a.append(i)
			s += i
		a.append(n // 2 * (n // 2 + 1) - s)
		print(*a)


cases = int(input())
for i in range(cases):
	n = int(input()) // 2
	lis = [2 * a for a in range(1, n + 1)]
	lis += [2 * a + 1 for a in range(0, n - 1)]
	num_to_add = n * (n + 1) - (n - 1) ** 2
	if num_to_add % 2 != 0:
		lis.append(num_to_add)
		print('YES')
		print(' '.join(map(str, lis)))
	else:
		print('NO')


t = int(input())
ques = list()
for test_case in range(t):
	ques.append(int(input()))
for num in ques:
	if num // 2 % 2:
		print('NO')
	else:
		print('YES')
		sum_even = 0
		sum_odd = 0
		for i in range(2, num + 1, 2):
			print(i, end='\t')
			sum_even += i
		for i in range(1, num - 1, 2):
			print(i, end='\t')
			sum_odd += i
		print(sum_even - sum_odd)


def func(n):
	k = n // 2
	e = k * (k + 1)
	o = k * (k + 1) - k
	print('YES')
	for i in range(1, k + 1):
		print(2 * i, end=' ')
	for i in range(1, k):
		print(2 * i - 1, end=' ')
	x = 2 * (i + 1) - 1
	print(x + e - o)
for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		func(n)
	else:
		print('NO')


case = int(input())
for n in range(case):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		half = int(n / 2)
		for i in range(half):
			a.append(2 * (i + 1))
		for i in range(half):
			a.append(2 * (i + 1) - 1)
		a[-1] = a[-1] + half
		for i in range(len(a)):
			a[i] = str(a[i])
		print(' '.join(a))


tests = int(input())
results = []
for i in range(tests):
	n = int(input())
	if n % 4 != 0:
		results.append([])
	else:
		res = [0] * n
		for i in range(n // 4):
			res[2 * i] = 2 + 6 * i
			res[2 * i + 1] = 4 + 6 * i
			res[n - 1 - 2 * i] = 1 + 6 * i
			res[n - 2 - 2 * i] = 5 + 6 * i
		results.append(res)
for result in results:
	if len(result) == 0:
		print('NO')
	else:
		print('YES')
		for num in result:
			print(num, end=' ')
		print('')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		k = 2
		kk = 1
		sum = 0
		a = []
		suma = 0
		for j in range(n // 2):
			a.append(k + 2 * j)
			sum += k + 2 * j
		for j in range(n // 2 - 1):
			a.append(kk + 2 * j)
			suma += kk + 2 * j
		a.append(sum - suma)
		print(*a)


for i in range(int(input())):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		x = [i * 2 for i in range(1, n // 2 + 1)]
		y = [i - 1 for i in x]
		y[-1] += sum(x) - sum(y)
		x.extend(y)
		print('YES')
		print(*x)


num = int(input())
for _ in range(num):
	n = int(input())
	half = n // 2
	if half % 2 == 1:
		print('NO')
		continue
	ans = []
	for i in range(1, half + 1):
		ans.append(2 * i)
	for i in range(half - 1):
		ans.append(1 + 2 * i)
	ans.append(1 + 2 * (half - 1) + half)
	print('YES')
	for i in ans:
		print('{} '.format(i), end='')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		f = list(range(2, n + 1, 2))
		l = list(range(1, n + 1, 2))
		l = l[:len(l) - 1]
		l.append(sum(f) - sum(l))
		for i in f:
			print(i, sep=' ', end=' ')
		for i in l:
			print(i, sep=' ', end=' ')
		print()


def outputer(n):
	while True:
		left = []
		right = []
		if n % 2 != 0:
			print('NO')
			break
		for i in range(2, n + 1, 2):
			left.append(i)
		for j in range(1, n + 2, 2):
			right.append(j)
		right.pop(-(n // 4) - 1)
		if sum(left) == sum(right):
			print('YES')
			print(*left, *right)
			break
		else:
			print('NO')
			break

def bsolution():
	t = int(input())
	while t != 0:
		n = int(input())
		outputer(n)
		t -= 1
bsolution()


t = int(input())
for _ in range(t):
	n = int(input())
	l = 2
	se = 0
	so = 0
	if n % 4 == 0:
		print('YES')
		for i in range(n // 2):
			print(l, end=' ')
			se = se + l
			l = l + 2
		l = 1
		for i in range(n // 2 - 1):
			print(l, end=' ')
			so = so + l
			l = l + 2
		print(se - so, end=' ')
		print(end='\n')
	else:
		print('NO')


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = n // 2
		r = [2]
		l = [1]
		s = 2
		c = 1
		if n == 4:
			print(2, 4, 1, 5)
		else:
			for i in range(1, k):
				r.append(2 + r[i - 1])
				s = s + r[i]
			for i in range(1, k - 1):
				l.append(2 + l[i - 1])
				c = c + l[i]
			l.append(abs(s - c))
			for i in range(k):
				print(r[i], end=' ')
			for i in range(k):
				print(l[i], end=' ')
			print()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		h = n // 2
		l = [2 * (i + 1) for i in range(h)]
		for i in range(1, 2 * (h - 1), 2):
			l.append(i)
		l.append(3 * h - 1)
		for i in l:
			print(i, end=' ')
		print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cntx = [0] * (2 * k + 1)
	prefx = [0] * (2 * k + 2)
	for i in range(n // 2):
		cntx[a[i] + a[n - i - 1]] += 1
		prefx[min(a[i], a[n - i - 1]) + 1] += 1
		prefx[max(a[i], a[n - i - 1]) + k + 1] += -1
	ans = n
	p = 0
	for i in range(2, 2 * k + 1):
		p += prefx[i]
		ans = min(ans, p - cntx[i] + (n // 2 - p) * 2)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		array = [2 * j for j in range(1, 1 + n // 2)] + [2 * j - 1 for j in range(1, n // 2)] + [3 * n // 2 - 1]
		print(' '.join([str(a) for a in array]))


k = int(input())
for j in range(k):
	n = int(input())
	if n % 4 > 0:
		print('NO')
	else:
		print('YES')
		a = []
		b = []
		cnt = 1
		for q in range(n // 2 - 1):
			b.append(cnt)
			a.append(cnt + 1)
			cnt += 2
		a.append(cnt + 1)
		b.append(sum(a) - sum(b))
		print(*a, end=' ')
		print(*b)


t = int(input())
while t != 0:
	n = int(input())
	x = n // 2
	if x % 2:
		print('NO')
	else:
		print('YES')
		A = []
		i = 1
		while i <= x:
			A.append(2 * i)
			i += 1
		i = 0
		while i <= x - 2:
			A.append(2 * i + 1)
			i += 1
		A.append(3 * x - 1)
		print(*A)
	t -= 1


número_de_casos_t = int(input())
for a in range(1, número_de_casos_t + 1):
	b = int(input())
	if b // 2 % 2 != 0:
		print('NO')
	else:
		lista = list(range(b))
		for i in range(b):
			if 0 <= i < b // 2:
				valor = 2 * i + 2
			else:
				valor = 2 * (i - b // 2) + 1
				if valor == b - 1:
					valor = b - 1 + b // 2
			lista[i] = str(valor)
		print('YES')
		s = ' '.join(lista)
		print(s)


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	pairs = []
	psum = []
	pre1 = [0 for i in range(2 * k + 2)]
	pre0 = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		pairs.append([a[i], a[n - i - 1]])
	for p in pairs:
		psum.append([min(p[0], p[1]) + 1, max(p[0], p[1]) + k])
		pre0[p[0] + p[1]] = pre0[p[0] + p[1]] + 1
	for (mi, ma) in psum:
		pre1[mi] = pre1[mi] + 1
		pre1[ma + 1] = pre1[ma + 1] - 1
	presum = 0
	for i in range(2, 2 * k + 2):
		presum = pre1[i] + presum
		pre1[i] = presum
	minch = n
	for i in range(2, 2 * k + 2):
		count0 = pre0[i]
		count1 = pre1[i] - count0
		count2 = n // 2 - count0 - count1
		total = 1 * count1 + 2 * count2
		minch = min(minch, total)
	print(minch)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		result = []
		haha = 2
		m = n // 2
		while m:
			result.append(haha)
			haha += 2
			m -= 1
		m = n // 2
		haha = 1
		sumi = 0
		while m - 1:
			result.append(haha)
			sumi += haha
			haha += 2
			m -= 1
		result.append(n // 2 * (n // 2 + 1) - sumi)
		for i in range(len(result)):
			if i == len(result) - 1:
				print(result[i])
			else:
				print(result[i], end=' ')


def search(cumurange, target, lwr=0, upr=False):
	if not upr:
		upr = len(cumurange) - 1
	if upr - lwr == 1:
		if cumurange[upr][0] < target:
			return cumurange[upr]
		else:
			return cumurange[lwr]
	avg = (upr + lwr) // 2
	test = cumurange[avg]
	if test[0] > target:
		return search(cumurange, target, lwr, avg)
	else:
		return search(cumurange, target, avg, upr)
T = int(input())
for test in range(T):
	(N, K) = list(map(int, input().split()))
	array = list(map(int, input().split()))
	totalpairs = N // 2
	pairsum = {}
	exceed2 = 0
	exceed1 = 0
	bounds = {}
	for n in range(totalpairs):
		a1 = array[n]
		a2 = array[N - 1 - n]
		sm = a1 + a2
		if a1 > K and a2 > K:
			exceed2 += 1
			continue
		elif a1 > K or a2 > K:
			a = min(a1, a2)
			minsum = a + 1
			maxsum = a + K + 1
		else:
			minsum = min(a1, a2) + 1
			maxsum = max(a1, a2) + K + 1
			asum = a1 + a2
			if asum in pairsum.keys():
				pairsum[asum] += 1
			else:
				pairsum[asum] = 1
		if minsum in bounds.keys():
			bounds[minsum] += 1
		else:
			bounds[minsum] = 1
		if maxsum in bounds.keys():
			bounds[maxsum] -= 1
		else:
			bounds[maxsum] = -1
	boundorder = sorted(bounds.items(), key=lambda x: x[0])
	cumulativerange = [boundorder[0]]
	for n in range(1, len(boundorder)):
		(pos, qty) = boundorder[n]
		prevqty = cumulativerange[n - 1][1]
		cumulativerange.append((pos, qty + prevqty))
	pairsum = list(pairsum.items())
	changes = []
	for cumu in cumulativerange:
		changes.append(N - cumu[1])
	for pair in pairsum:
		(pos, val) = pair
		cumu = search(cumulativerange, pos)
		changes.append(N - cumu[1] - val)
	minchanges = min(changes)
	print(minchanges)


import os
from collections import defaultdict

def f(nums, k):
	n = len(nums)
	n2 = n // 2
	p = defaultdict(int, {})
	mi = defaultdict(int, {})
	ma = defaultdict(int, {})
	for i in range(n2):
		p[nums[i] + nums[n - i - 1]] += 1
		mi[min(nums[i], nums[n - i - 1])] += 1
		ma[max(nums[i], nums[n - i - 1])] += 1
	mlx = 0
	mgx = 0
	cost = n
	for x in range(2 * k + 1):
		mlx += mi[x - 1]
		mgx += ma[x - k - 1]
		cost = min(n - mlx - p[x] + mgx, cost)
	return cost

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		k = int(input().split()[1])
		print(f(list(map(int, input().split())), k))
if 'paalto' in os.getcwd():
	from string_source import string_source
	s = string_source('4\n4 2\n1 2 1 2\n4 3\n1 2 2 1\n8 7\n6 1 1 7 6 3 4 6\n6 6\n5 2 6 1 3 4')
	pp(s)
else:
	pp(input)


for q in range(int(input())):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 1, 2):
			print(i, end=' ')
		print(n - 1 + int(n / 2))


t = eval(input())
for i in range(t):
	mus = []
	ras = 0
	fog = 0
	pop = int(input())
	if pop % 2 != 0:
		print('NO')
	else:
		kok = pop // 2
		if kok % 2 == 0:
			print('YES')
			for j in range(1, kok + 1):
				mus += [j * 2]
				ras += j * 2
			for t in range(1, kok):
				mus += [t * 2 - 1]
				fog += t * 2 - 1
			p = ras - fog
			mus += [p]
			for u in mus:
				print(u, end=' ')
		else:
			print('NO')


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		for i in range(n):
			if (i + 1) % 2 == 0:
				print(i + 1, end=' ')
		for i in range(n):
			if (i + 1) % 2 == 1:
				if i == n - 2:
					print(int(i + 1 + 2 * n / 4))
					break
				print(i + 1, end=' ')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = [0] * (2 * k + 2)
	for i in range(n // 2):
		s = a[i] + a[-(i + 1)]
		ans[s - max(a[i], a[-(i + 1)]) + 1] += 1
		ans[s] += 1
		ans[s + 1] -= 1
		ans[s + k - min(a[i], a[-(i + 1)]) + 1] -= 1
	for i in range(1, 2 * k + 2):
		ans[i] += ans[i - 1]
	print(n - max(ans))


for _ in ' ' * int(input()):
	a = int(input())
	if a // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		k = []
		for i in range(2, a + 1, 2):
			print(i, end=' ')
			k += [i - 1]
		k[-1] += a // 2
		print(*k, sep=' ')


n = int(input())
for i in range(n):
	k = int(input())
	if not k % 4:
		ans = []
		for j in range(1, k + 1):
			if not j & 1:
				ans.append(j)
		for j in range(1, k + 2):
			if j & 1 and j != (k + 2) // 2:
				ans.append(j)
		print('YES')
		for item in ans:
			print(item, end=' ')
		print()
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	lsum = [0] * (n // 2)
	rsum = [0] * (n // 2)
	for i in range(n // 2):
		lsum[i] = 2 * (i + 1)
	for i in range(n // 2 - 1):
		rsum[i] = 2 * (i + 1) - 1
	rsum[-1] = sum(lsum) - sum(rsum)
	ans = lsum + rsum
	print('YES')
	print(*ans, sep=' ')


from collections import defaultdict
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	ip = [int(k) for k in input().split()]
	li = [[] for i in range(n // 2)]
	n = len(ip)
	for j in range(n // 2):
		li[j].append(min(ip[j], ip[n - j - 1]))
		li[j].append(max(ip[j], ip[n - j - 1]))
	ans = 10 ** 10
	prefix = [0] * (2 * m + 5)
	hash0 = defaultdict(int)
	for j in range(n // 2):
		hash0[ip[j] + ip[n - j - 1]] += 1
		prefix[li[j][0] + 1] += 1
		prefix[li[j][1] + m + 1] -= 1
		tot = 0
	for i in range(0, 2 * m + 1):
		tot += prefix[i]
		prefix[i] = tot
	for i in range(2, 2 * m + 1):
		c0 = hash0[i]
		c1 = prefix[i] - c0
		c2 = n // 2 - (c0 + c1)
		ans = min(ans, 2 * c2 + c1)
	print(ans)


def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))
import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		arr1 = []
		arr2 = []
		for i in range(2, n + 1, 2):
			arr1.append(i)
			arr2.append(i - 1)
		arr2[-1] += n // 2
		ans = arr1 + arr2
		oneLineArrayPrint(ans)


from itertools import count, chain

def foo(v):
	if v // 2 % 2:
		print('NO')
	else:
		v = v // 2
		print('YES')
		even = list(range(2, v * 2 + 1, 2))
		odd = list(range(1, v * 2, 2))
		suma = sum(even)
		sumo = sum(odd) - odd[-1]
		odd[-1] = suma - sumo
		X = chain(even, odd)
		print(' '.join((str(i) for i in X)))
test = int(input())
while test:
	test -= 1
	v = int(input())
	foo(v)


n = int(input())
s = [int(input()) for i in range(n)]
for v in s:
	c = v // 2
	if c % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(c):
			print(2 * i + 2, end=' ')
		for i in range(c - 1):
			print(2 * i + 1, end=' ')
		print(3 * c - 1)


for ppi in range(int(input())):
	length = int(input())
	if length % 4 == 0:
		l = sorted([i + 1 for i in range(length)], key=lambda x: x % 2)
		l[length - 1] += length // 2
		print('yes')
		for c in l:
			print(c, end=' ')
		print()
	else:
		print('no')


t = int(input())
for asdf in range(t):
	n = int(input())
	even_array = []
	odd_array = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		even_array = [i for i in range(2, n + 1, 2)]
		odd_array = [i for i in range(1, n, 2)]
		ans = []
		for i in range(n // 2):
			ans.append(even_array[i])
		sum_even = sum(ans)
		sum_odd = 0
		for i in range(n // 2 - 1):
			ans.append(odd_array[i])
			sum_odd += odd_array[i]
		d2 = sum_even - sum_odd
		ans.append(d2)
		for i in ans:
			print(i, end=' ')
		print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().strip().split()))[:n]
	from collections import defaultdict
	store = defaultdict(int)
	limits = [0] * (2 * k + 2)
	for i in range(n // 2):
		a = min(arr[i], arr[n - i - 1]) + 1
		b = max(arr[i], arr[n - i - 1]) + k
		sims = arr[i] + arr[n - i - 1]
		store[sims] += 1
		limits[a] += 1
		limits[b + 1] -= 1
	for i in range(1, 2 * k + 2):
		limits[i] += limits[i - 1]
	ans = float('inf')
	for sums in range(2, 2 * k + 1):
		z_count = store[sums]
		o_count = limits[sums] - z_count
		t_count = n // 2 - z_count - o_count
		if ans > t_count * 2 + o_count:
			ans = t_count * 2 + o_count
	print(ans)


import math
t = eval(input())
for j in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		l = list((2 * i for i in range(1, n // 2 + 1)))
		l1 = [1]
		x = 3
		for i in range(2, n // 2):
			l1.append(x)
			x = x + 2
		l1.append(sum(l) - sum(l1))
		print('YES')
		for k in l + l1:
			print(k, end=' ')
		print()


t = int(input())
for i in range(t):
	a = int(input())
	even = [2]
	odd = [1]
	if a == 2 or a % 2 != 0 or a // 2 % 2 != 0:
		print('NO')
	else:
		for j in range(0, a // 2 - 1):
			even.append(even[j] + 2)
		for j in range(0, a // 4):
			odd.append(even[j] - 1)
		for j in range(a // 4, a // 2):
			odd.append(even[j] + 1)
		print('YES')
		print(*sorted(set(even)), *sorted(set(odd)))


t = int(input())
for i in range(t):
	n = int(input())
	ni = int(n / 2)
	if ni % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for j in range(ni):
			l.append((j + 1) * 2)
		for k in range(ni - 1):
			l.append((k + 1) * 2 - 1)
		l.append(ni * 2 - 1 + ni)
		print(*l, sep=' ')


for _ in range(int(input())):
	x: int = int(input())
	y: int = int(x / 2)
	if y % 2 == 1 or x == 2:
		print('NO')
	else:
		print('YES')
		arr = []
		for i in range(y):
			arr.append((i + 1) * 2)
		sum = y * (y + 1)
		for j in range(x - 1):
			if j < y:
				print(arr[j], end=' ')
			else:
				print(arr[j - y] - 1, end=' ')
		print(sum - (y - 1) ** 2)


def program():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	even = [x for x in range(2, n + 1, 2)]
	odd = [x for x in range(1, n - 1, 2)]
	odd.append(sum(even) - sum(odd))
	print('YES')
	for x in even:
		print(x, end=' ')
	for x in odd:
		print(x, end=' ')
	print()
t = int(input())
for i in range(t):
	program()


for _ in range(int(input())):
	n = int(input())
	print(*(n % 4 and ['NO'] or ['YES'] + [*range(2, n + 1, 2)] + [n + n // 2 - 1] + [*range(1, n - 1, 2)]))


w = int(input())
a = []
if w >= 1 and w <= 10000:
	for i in range(0, w):
		p = int(input())
		if int(p) >= 2 and int(p) <= 200000:
			a.append(p)
	for i in range(0, w):
		b = []
		c = []
		sum1 = 0
		sum2 = 0
		r = a[i]
		if int(r) % 4 != 0:
			print('NO')
		else:
			print('YES')
			for t in range(2, int(r) + 2, 2):
				b.append(t)
				sum1 = sum1 + t
			for t in range(1, int(r) - 2, 2):
				c.append(t)
				sum2 = sum2 + t
			d = sum1 - sum2
			c.append(d)
			b.extend(c)
			print(*b)


def solve():
	n = int(input())
	if n // 2 % 2 != 0:
		return None
	else:
		par = [2 * i for i in range(1, n // 2 + 1)]
		impar = [2 * i - 1 for i in range(1, n // 2)]
		impar += [sum(par) - sum(impar)]
	return par + impar
t = int(input())
for i in range(t):
	ans = solve()
	if ans is None:
		print('NO')
	else:
		print('YES')
		print(' '.join(list(map(str, ans))))


n = int(input())
q = []
for _ in range(n):
	q.append(int(input()))
for i in q:
	if i // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		o = []
		for j in range(i // 2):
			o.append((j + 1) * 2)
		s = sum(o)
		for j in range(i // 2 - 1):
			o.append((j + 1) * 2 - 1)
			s -= o[-1]
		o.append(s)
		print(*o)


import math
m = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		sol = []
		s = 0
		s1 = 0
		for i in range(2, n + 1, 2):
			sol.append(i)
			s += i
		for i in range(1, n - 1, 2):
			sol.append(i)
			s1 += i
		sol.append(s - s1)
		print(*sol)


for _ in range(int(input())):
	n = int(input())
	x = 2
	y = 1
	a = n // 2
	even = []
	odd = []
	for i in range(a):
		even.append(x)
		x += 2
	for i in range(a - 1):
		odd.append(y)
		y += 2
	if n % 4 != 0:
		print('NO')
	else:
		odd.append(sum(even) - sum(odd))
		print('YES')
		print(*even + odd)


num = int(input())
ans = ''
for i in range(num):
	n = int(input())
	if n // 2 % 2 == 0:
		temp = [str(i) for i in range(2, n + 1, 2)]
		temp1 = [str(int(temp[i]) - 1) for i in range(len(temp) - 1)] + [str(len(temp) - 1 + int(temp[-1]))]
		ans += f'YES\n' + ' '.join(temp + temp1) + '\n'
	else:
		ans += 'NO\n'
print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 0:
		print('YES')
		A = list(range(2, n + 1, 2))
		B = list(range(1, n - 1, 2))
		Bf = sum(A) - sum(B)
		print(' '.join(map(str, A)) + ' ' + ' '.join(map(str, B)) + ' ' + str(Bf))
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	(a_d, b_d, ab_d) = ([0] * (2 * k + 3), [0] * (2 * k + 3), [0] * (2 * k + 3))
	for i in range(int(n / 2)):
		(a, b) = (l[i], l[n - i - 1])
		(a, b) = (min(a, b), max(a, b))
		a_d[a + 1] += 1
		b_d[k + b + 1] += 1
		ab_d[a + b] += 1
	val = n
	sol = n
	for i in range(len(ab_d)):
		val = val - a_d[i] + b_d[i]
		sol = min(val - ab_d[i], sol)
	print(sol)


arr = []
arrod = []
k = 0
for i in range(0, 300006, 6):
	arr.append(i + 2)
	arr.append(i + 6)
	arrod.append(i + 3)
	arrod.append(i + 5)
for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		bigarr = []
		print('YES')
		bigarr += arr[:n // 2]
		bigarr += arrod[:n // 2]
		print(*bigarr)


n = int(input())
for i in range(n):
	t = int(input())
	l1 = []
	l2 = []
	l3 = []
	l3 = l1 + l2
	if t % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, t + 1):
			if i % 2 == 0:
				l1.append(i)
			else:
				l2.append(i)
		l3 = l1 + l2
		l3[t - 1] = l3[t - 1] + int(t / 2)
		l3 = str(l3)[1:-1]
		print(l3.replace(',', ''))


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		p = n
		e = []
		o = []
		ev = 2
		od = 1
		c = 0
		while c < n // 4:
			c += 1
			e.append(p - ev)
			e.append(p + ev)
			o.append(p - od)
			o.append(p + od)
			ev += 2
			od += 2
		e.extend(o)
		print('YES')
		print(*e)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	e = []
	o = []
	for i in range(1, n // 2 + 1):
		e.append(2 * i)
		if i < n // 2:
			o.append(2 * i - 1)
	s = 0
	for x in e:
		s += x
		print(x, end=' ')
	for x in o:
		s -= x
		print(x, end=' ')
	print(s)


T = int(input())
for _ in range(T):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		s1 = ''
		count = 0
		for i in range(2, n + 1, 2):
			s1 += str(i) + ' '
			count += i
		s2 = ''
		count1 = 0
		for i in range(1, n - 1, 2):
			s2 += str(i) + ' '
			count1 += i
		ans = count - count1
		final_s = s1 + s2 + str(ans)
		print('YES')
		print(final_s)


test_case = int(input())
while test_case > 0:
	boo = False
	size = int(input())
	n = size // 2
	sum_even = n * (n + 1)
	sum_odd = (n - 1) * (n - 1)
	i = size - 1
	while sum_even >= sum_odd + i:
		if sum_odd + i == sum_even:
			boo = True
			break
		else:
			i += 2
			temp = i
	if boo:
		print('YES')
		for j in range(2, size + 1, 2):
			print(j, end=' ')
		for j in range(1, size - 2, 2):
			print(j, end=' ')
		print(temp)
	else:
		print('NO')
	test_case -= 1


t = int(input())
for tt in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		ans = [*range(2, n + 1, 2)] + [*range(1, n - 1, 2)]
		ans.append(ans[n // 2 - 1] + n // 2 - 1)
		print(' '.join(map(str, ans)))


t = int(input())
for k in range(t):
	n = int(input())
	d = int(n / 2)
	if d % 2 != 0:
		print('NO')
	else:
		ans = []
		s = 0
		for i in range(2, (d + 1) * 2, 2):
			ans.append(i)
			s = s + i
		so = 0
		for j in range(1, d * 2 - 1, 2):
			ans.append(j)
			so = so + j
		ans.append(s - so)
		print('YES')
		for l in ans:
			print(l, end=' ')
		print('')


def bsl(n, m, num):
	left = -1
	right = n
	while right - left > 1:
		middle = (left + right) // 2
		if m[middle] >= num:
			right = middle
		else:
			left = middle
	return right

def bsr(n, m, num):
	left = -1
	right = n
	while right - left > 1:
		middle = (left + right) // 2
		if m[middle] > num:
			right = middle
		else:
			left = middle
	return left

def count(n, num, max1, min1):
	ans = 0
	ans += 2 * (n - bsr(n, min1, num) - 1)
	ans += 2 * bsl(n, max1, num)
	ans += n - cs[num] - ans // 2
	return ans
for j in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = list()
	ss = list()
	sw = set()
	cs = dict()
	max1 = list()
	min1 = list()
	for i in range(n // 2):
		max1.append(max(a[i], a[n - i - 1]) + k)
		min1.append(min(a[i], a[n - i - 1]) + 1)
		xxx = a[i] + a[n - i - 1]
		if xxx not in sw:
			sw.add(xxx)
			s.append(xxx)
			cs[xxx] = 1
		else:
			cs[xxx] += 1
		ss.append(xxx)
	max1.sort()
	min1.sort()
	ss.sort()
	n //= 2
	ans = float('inf')
	for suma in s:
		ans = min(ans, count(n, suma, max1, min1))
	if min1[-1] <= max1[0]:
		ans = min(ans, n)
	print(ans)


t = int(input())
for i in range(t):
	a = int(input())
	if a % 4:
		print('NO')
		continue
	else:
		print('YES')
		output = ''
		for j in range(2, a + 1, 2):
			output += str(j) + ' '
		for j in range(1, a // 2, 2):
			output += str(j) + ' '
		for j in range(a // 2 + 3, a + 2, 2):
			output += str(j) + ' '
		print(output)
		continue


tt = int(input())
while tt:
	n = int(input())
	n = n / 2
	if n % 2 != 0:
		print('NO')
	else:
		i = 0
		stri = ''
		while i < n:
			stri += str((i + 1) * 2) + ' '
			i += 1
		i = 0
		while i < n - 1:
			stri += str(2 * i + 1) + ' '
			i += 1
		stri += str(int(n * (n + 1) - (n - 1) ** 2))
		print('YES')
		print(stri)
	tt -= 1


for _ in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
		continue
	even = [i for i in range(2, n + 1, 2)]
	odd = [i - 1 for i in even[:n // 4]] + [i + 1 for i in even[n // 4:]]
	print('YES')
	print(' '.join(map(str, even + odd)))


n = int(input())
x = [int(input()) for _ in range(n)]
for i in x:
	c = i // 2
	if c % 2 == 0:
		print('Yes')
		m = 0
		s = 0
		for i in range(1, c + 1):
			print(2 * i, end=' ')
			m = m + 2 * i
		for i in range(0, c - 1):
			print(2 * i + 1, end=' ')
			s = s + (2 * i + 1)
		print(m - s)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('Yes')
		a = [0] * (n // 2)
		b = [0] * (n // 2)
		for j in range(n // 2):
			a[j] = j * 2 + 1
		for j in range(n // 2):
			b[j] = j * 2 + 2
		a[-1] += n // 2
		b += a
		print(*b)


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

def solve(n):
	if n % 4 == 0:
		print('YES')
		arr = [2 * i for i in range(1, n // 2 + 1)]
		arr += [2 * i + 1 for i in range(n // 2)]
		arr[-1] += n // 2
		for a in arr:
			print(a, end=' ')
	else:
		print('NO')
main()


def arr(N):
	for i in range(2, N + 1, 2):
		print(i, end=' ')
	for i in range(1, N - 1, 2):
		print(i, end=' ')
	print(N - 1 + N // 2)
t = int(input())
for item in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		arr(n)
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = [0] * (2 * k + 1)
	prefix = [0] * (2 * k + 2)
	for i in range(n // 2):
		a[l[i] + l[n - 1 - i]] += 1
		prefix[min(l[i], l[n - i - 1]) + 1] += 1
		prefix[max(l[i], l[n - i - 1]) + 1 + k] -= 1
	for i in range(1, 2 * k + 2):
		prefix[i] += prefix[i - 1]
	ans = 10 ** 9
	for i in range(2, 2 * k + 1):
		ans = min(ans, prefix[i] - a[i] + 2 * (n // 2 - prefix[i]))
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
		continue
	else:
		ind = n // 2
		arr = []
		s = 0
		o = 0
		for i in range(2, n + 1, 2):
			arr.append(i)
			s += i
		for i in range(1, n - 1, 2):
			arr.append(i)
			o += i
		arr.append(s - o)
	print('YES')
	print(*arr)


number_of_test_cases = int(input())
for i in range(number_of_test_cases):
	array_length = int(input())
	if (array_length + (array_length / 2 - 1)) % 2 == 0:
		print('NO')
	else:
		print('YES')
		even_numbers = [i for i in range(2, array_length + 1, 2)]
		last_odd_number = int(array_length + (array_length / 2 - 1))
		odd_numbers = [j for j in range(1, array_length - 1, 2)] + [last_odd_number]
		balanced_array = even_numbers + odd_numbers
		print(' '.join(map(str, balanced_array)))


t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pair_sum = [0 for y in range(2 * k + 2)]
	i = 0
	while i < n // 2:
		pair_sum[2] += 2
		pair_sum[min(a[i], a[n - i - 1]) + 1] += -1
		pair_sum[max(a[i], a[n - i - 1]) + k + 1] += 1
		pair_sum[a[i] + a[n - i - 1]] += -1
		pair_sum[a[i] + a[n - i - 1] + 1] += 1
		i += 1
	min_val = pair_sum[2]
	for i in range(3, 2 * k + 1):
		pair_sum[i] += pair_sum[i - 1]
		if pair_sum[i] < min_val:
			min_val = pair_sum[i]
	print(min_val)


import io
import os
from sys import stdout
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	a = n // 2 * (n // 2 + 1)
	b = (n // 2 - 1) ** 2
	if (a - b) % 2 == 1:
		print('YES\n')
		for i in range(2, n + 1, 2):
			print(str(i) + ' ')
		for i in range(1, n - 1, 2):
			print(str(i) + ' ')
		print(str(a - b) + '\n')
	else:
		print('NO\n')


t = int(input())
for i in range(t):
	n = int(input())
	jii = n // 2
	if n % 2 == 0 and n % 4 != 0 or (n % 2 == 1 and jii % 2 == 0):
		print('NO')
	else:
		sm = 0
		print('YES')
		for i in range(n // 2):
			k = 2 * n + 2 * i
			print(k, end=' ')
			sm += k
			l = k
		if n % 2 == 0:
			sm1 = 0
			g = 0
			for i in range(n // 2, n):
				if i != n - 1:
					k1 = 2 * n - 1 + 2 * g
					g += 1
					print(k1, end=' ')
					sm1 += k1
				else:
					print(l + g)
		else:
			sm1 = 0
			g = 0
			for i in range(n // 2, n):
				if i != n - 1:
					k1 = 2 * n - 1 + 2 * g
					g += 1
					print(k1, end=' ')
					sm1 += k1
				else:
					print(g)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().rstrip().split())
	arr = list(map(int, input().rstrip().split()))
	pairsNeeding0chng = {}
	pairsNeeding01chng = [0] * (2 * k + 2)
	for pos in range(n // 2):
		L = min(arr[pos], arr[n - pos - 1])
		R = max(arr[pos], arr[n - pos - 1])
		if L + R in pairsNeeding0chng:
			pairsNeeding0chng[L + R] += 1
		else:
			pairsNeeding0chng[L + R] = 1
		pairsNeeding01chng[L + 1] += 1
		pairsNeeding01chng[R + k + 1] -= 1
	for pos in range(2, len(pairsNeeding01chng)):
		pairsNeeding01chng[pos] += pairsNeeding01chng[pos - 1]
	pairsNeeding01chng.pop()
	minChngs = -1
	for x in range(2, 2 * k + 1):
		noOf0pair = 0
		if x in pairsNeeding0chng:
			noOf0pair += pairsNeeding0chng[x]
		noOf1pair = pairsNeeding01chng[x] - noOf0pair
		noOf2pair = n // 2 - noOf0pair - noOf1pair
		totChngs = noOf1pair + noOf2pair * 2
		if totChngs < minChngs or minChngs == -1:
			minChngs = totChngs
	print(minChngs)


def Sumof(tab):
	sm = 0
	for item in tab:
		sm += item
	return sm

def main():
	t = int(input())
	for turn in range(t):
		n = int(input())
		if n // 2 % 2 != 0:
			print('NO')
			pass
		else:
			print('YES')
			tab = []
			tab1 = []
			tab2 = []
			d = 2
			e = 1
			for x in range(0, n // 2):
				tab1.append(d)
				d += 2
			m = Sumof(tab1)
			for x in range(0, n // 2):
				if x == n // 2 - 1:
					if m % 2 != 0:
						tab2.append(m)
						break
					else:
						pass
				else:
					tab2.append(e)
					m -= e
					e += 2
			tab = tab1 + tab2
			for i in tab:
				print(i, end=' ')
	return 0
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if not n % 4:
		print('YES')
		e = list(range(2, n + 1, 2))
		o = list(range(1, n - 1, 2))
		o.append(sum(e) - sum(o))
		for i in e + o:
			print(i, end=' ')
		print()
	else:
		print('NO')


alph = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	n = int(input(''))
	if n // 2 % 2 == 1:
		print('NO')
	else:
		i = 2
		sum = 0
		a = []
		for _ in range(n // 2):
			sum = sum + i
			a.append(i)
			i += 2
		i = 1
		sum2 = 0
		for _ in range(n // 2 - 1):
			a.append(i)
			sum2 = sum2 + i
			i = i + 2
		a.append(sum - sum2)
		print('YES')
		for x in a:
			print(x, end=' ')
		print()


for i in range(int(input())):
	(n, k) = map(int, input().split())
	map1 = {}
	pref = []
	l = list(map(int, input().split()))
	for j in range(0, 2 * k + 2):
		pref.append(0)
	for j in range(n // 2):
		if map1.get(l[j] + l[n - j - 1]) != None:
			map1[l[j] + l[n - j - 1]] += 1
		else:
			map1[l[j] + l[n - j - 1]] = 1
	summ = []
	for j in range(n // 2):
		summ.append((l[j], l[n - j - 1]))
	for j in range(n // 2):
		min_sum = min(summ[j][1], summ[j][0]) + 1
		max_sum = max(summ[j][1], summ[j][0]) + k
		pref[min_sum] += 1
		pref[max_sum + 1] -= 1
	for j in range(3, 2 * k + 2):
		pref[j] = pref[j - 1] + pref[j]
	min_value = 10000000
	for j in range(2, 2 * k + 1):
		if map1.get(j) != None:
			a = map1[j]
		else:
			a = 0
		b = pref[j]
		if min_value > 1 * (b - a) + 2 * (n // 2 - b):
			min_value = 1 * (b - a) + 2 * (n // 2 - b)
	print(min_value)


from sys import stdin, stdout
for i in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	else:
		if n == 2:
			print('NO')
			continue
		print('YES')
		ans = ''
		for i in range(1, int(n // 2) + 1):
			ans += str(2 * i) + ' '
		f = int(ans[0])
		l = int(n)
		n1 = (f + l) / 2 - 1
		s = n1 * (n1 + 1)
		for i in range(1, n - 1, 2):
			ans += str(i) + ' '
		ans += str(int(s - (n // 2 - 1) ** 2))
		stdout.write(ans)
		print()


ncases = int(input())
for i in range(ncases):
	n = int(input())
	half = int(n / 2)
	if half % 2 != 0:
		print('NO')
	else:
		l1 = []
		l2 = []
		initialevenmin = 2
		for i in range(half):
			l1.append(initialevenmin)
			initialevenmin = initialevenmin + 2
		s = sum(l1)
		initialoddmin = 1
		for j in range(int(half / 2)):
			l2.append(initialoddmin)
			initialoddmin += 2
		oddovertake = l1[int(len(l1) / 2)] + 1
		for k in range(int(half / 2)):
			l2.append(oddovertake)
			oddovertake = oddovertake + 2
		print('YES')
		for ele in l1:
			print(ele, end=' ')
		for ele in l2:
			print(ele, end=' ')
		print('')


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	if x % 2 == 0:
		print('YES')
		y = [0] * n
		i = 0
		j = 0
		while i < n:
			if i < n // 2:
				y[i] = (i + 1) * 2
			elif i < 3 * n // 4:
				y[i] = y[j] - 1
				j += 1
			else:
				y[i] = y[j] + 1
				j += 1
			i += 1
		print(*y)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		tam = n / 2
		a = [i for i in range(2, n + 1, 2)]
		b = [i for i in range(1, n - 1, 2)]
		somaA = (2 + n) * n / 4
		somaB = sum(b)
		b.append(int(somaA - somaB))
		for i in a:
			print(i, end=' ')
		for i in b:
			print(i, end=' ')
		print()


import math
n = int(input())
for i in range(1, n + 1):
	p = int(input())
	if p % 4 != 0:
		print('NO')
	else:
		print('YES')
		f = 0
		l = 0
		for h in range(p // 2):
			print(2 * h + 2, end=' ')
			f += 2 * h + 2
		for g in range(p // 2 - 1):
			print(2 * g + 1, end=' ')
			l += 2 * g + 1
		print(abs(f - l))


a = int(input())
s = []
for i in range(a):
	k = int(input())
	s.append(k)
for i in range(a):
	k = s[i]
	if k % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(k / 2) + 1):
			print(i * 2, end=' ')
		for i in range(1, int(k / 2)):
			print(2 * i - 1, end=' ')
		print(k + int(k / 2) - 1)


import sys

def f(*args, mem={}):
	pass

def main():
	ans = ''
	for _ in range(int(input())):
		c_ans = ''
		x = int(input())
		if not x / 2 % 2:
			c_ans = 'YES\n'
			l = []
			for i in range(1, int(x / 2 + 1)):
				l.append(i * 2)
			s = sum(l)
			sodd = 0
			for i in range(int(x / 2 - 1)):
				l.append(i * 2 + 1)
				sodd += i * 2 + 1
			l.append(s - sodd)
			c_ans += f"{' '.join(map(str, l))}"
		else:
			c_ans = 'NO'
		ans += f'{c_ans}\n'
	sys.stdout.write(ans)
main()


t = int(input())
while t:
	value = int(input())
	if value % 4:
		print('NO')
	else:
		print('YES')
		values = [2 * i for i in range(1, value // 2 + 1)]
		sum = 0
		for i in values:
			sum += i
		for i in range(len(values) - 1):
			values.append(2 * i + 1)
		count = 0
		for i in values:
			count += i
		values.append(2 * sum - count)
		for i in values:
			print(i, end=' ')
		print()
	t -= 1


t = int(input())
for q in range(t):
	n = int(input())
	half = n // 2
	array = []
	if half % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
	for x in range(half):
		array.append(2 * (x + 1))
	for x in range(half):
		array.append(2 * (x + 1) - 1)
	array[n - 1] += half
	print(*array)


t = int(input())
for test in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		k = 2
		diff = 0
		for i in range(n // 2):
			print(k, end=' ')
			k += 2
			diff += 1
		k = 1
		for i in range(n // 2 - 1):
			print(k, end=' ')
			k += 2
		print(k + diff, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	n = n // 2
	if n % 2 == 1:
		print('No')
		continue
	print('YES')
	l = [x * 2 for x in range(1, n + 1)]
	r = [x * 2 + 1 for x in range(n)]
	r[-1] += n
	ans = l + r
	for i in range(len(ans) - 1):
		print(ans[i], end=' ')
	print(ans[-1])


T = int(input())
for i in range(T):
	N = int(input())
	A = []
	flag = 0
	if N // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, N + 1):
			x = 2 * j
			A.append(x)
			if x == N:
				break
		for j in A:
			if j == N:
				break
			else:
				x = j - 1
				A.append(x)
				flag += 1
		A.append(N + flag)
		print(*A)


n = int(input())
for i in range(n):
	m = int(input())
	l1 = []
	l2 = []
	c = 0
	if m % 4 != 0:
		print('NO')
	else:
		print('YES')
		while c < m / 2:
			c += 1
			l1.append(2 * c)
		c = 0
		while c < m / 2 - 1:
			c += 1
			l2.append(2 * c - 1)
		k = sum(l1) - sum(l2)
		l2.append(k)
		l = l1 + l2
		for i in l:
			print(i, end=' ')


t = int(input())
while t > 0:
	n = int(input())
	res = n // 2
	b = []
	ans = 2
	b.append(ans)
	for i in range(1, res):
		ans = ans + 2
		b.append(ans)
	sum = 0
	for i in range(0, len(b)):
		sum = sum + b[i]
	k = 0
	flag = 0
	for i in range(res, n):
		if i == n - 1:
			if sum % 2 != 0:
				b.append(sum)
				flag = 1
		else:
			ans1 = 2 * k + 1
			b.append(ans1)
			k = k + 1
			sum = sum - ans1
	if flag == 1:
		print('YES')
		for i in b:
			print(i, end=' ')
		print('\r')
	else:
		print('NO')
	t = t - 1


import sys
import math
n = int(input())
for i in range(n):
	a = int(input())
	ll = []
	rl = []
	l = 2
	cnt = 0
	while 1:
		if cnt == a // 2:
			break
		ll.append(l)
		l += 2
		cnt += 1
	cnt = 0
	l = 1
	while 1:
		if cnt == a // 2:
			break
		rl.append(l)
		l += 2
		cnt += 1
	if sum(ll) % 2 == 1:
		print('No')
		continue
	elif sum(ll) == sum(rl):
		print('Yes')
		print(*ll, sep=' ', end='')
		print(' ', end='')
		print(*rl, sep=' ')
	else:
		del rl[-1]
		if (sum(ll) - sum(rl)) % 2 == 1:
			rl.append(sum(ll) - sum(rl))
			print('Yes')
			print(*ll, sep=' ', end='')
			print(' ', end='')
			print(*rl, sep=' ')
			continue
	print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	p = []
	(i, j) = (0, n - 1)
	while i < j:
		p.append((min(a[i], a[j]), max(a[i], a[j])))
		i += 1
		j -= 1
	pref = [0] * (2 * k + 2)
	freq = [0] * (2 * k + 2)
	for pair in p:
		freq[pair[0] + pair[1]] += 1
		pref[pair[0] + 1] += 1
		pref[pair[1] + k + 1] -= 1
	for m in range(2, 2 * k + 2):
		pref[m] += pref[m - 1]
	smin = 10 ** 9
	for m in range(2, 2 * k + 1):
		one = pref[m] - freq[m]
		two = n // 2 - pref[m]
		smin = min(smin, one + two * 2)
	print(smin)


k = int(input())
for i in range(k):
	n = int(input())
	a = [0] * n
	b = 1
	sum_i = 0
	sum_j = 0
	for i in range(1, n // 2 + 1):
		a[i - 1] = i * 2
		sum_i += i * 2
	for j in range(n // 2 + 1, n):
		a[j - 1] = b
		sum_j += b
		b += 2
	if (sum_i - sum_j) % 2 != 0 or sum_i - sum_j == 0:
		a[-1] = sum_i - sum_j
		print('YES')
		print(*a)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2:
		print('NO')
	else:
		print('YES')
		e = []
		o = []
		for j in range(1, int(n / 2) + 1):
			e.append(j * 2)
		for j in range(1, int(n / 2)):
			o.append(j * 2 - 1)
		o.append(sum(e) - sum(o))
		out = e + o
		print(' '.join(map(str, out)))


def r(s0, curr_min):
	count = 0
	for i in range(n // 2):
		s1 = a[i] + a[n - i - 1]
		if s1 > s0:
			t = s1 - s0
			if a[i] - t < 1 and a[n - i - 1] - t < 1:
				count += 2
			else:
				count += 1
		elif s1 < s0:
			t = s0 - s1
			if t + a[i] > k and t + a[n - i - 1] > k:
				count += 2
			else:
				count += 1
		if count > curr_min:
			break
	return count
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cnt = [0] * (2 * k + 1)
	for i in range(n // 2):
		s = a[i] + a[n - i - 1]
		if s < 2 * k + 1:
			cnt[s] += 1
	milestones = [0] * (2 * k + 1 + 1)
	for i in range(n // 2):
		milestones[min(a[i], a[n - i - 1]) + 1] += 1
		milestones[max(a[i], a[n - i - 1]) + k + 1] += -1
	pref = [0] * (2 * k + 1)
	for i in range(1, 2 * k + 1):
		pref[i] = pref[i - 1] + milestones[i]
	count = n
	for i in range(2, 2 * k + 1):
		count = min(count, pref[i] - cnt[i] + (n // 2 - pref[i]) * 2)
	print(count)


import sys
input = sys.stdin.readline
from itertools import accumulate
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	acc = [0] * (k * 2 + 2)
	for i in range(n // 2):
		(a1, a2) = (a[i], a[-i - 1])
		mn = min(a1, a2)
		acc[a1 + a2] -= 1
		acc[mn + 1] -= 1
		acc[2] += 2
		acc[a1 + a2 + 1] += 1
		acc[max(a1, a2) + k + 1] += 1
	aacc = list(accumulate(acc))
	aacc[0] = 10 ** 18
	aacc[1] = 10 ** 18
	aacc[k * 2 + 1] = 10 ** 18
	print(min(aacc))


for _ in range(int(input())):
	k = int(input())
	if k % 4 == 2:
		print('NO')
	else:
		l = []
		print('YES')
		c = 0
		j = 0
		while j < k // 2:
			p = 2 * (j + 1)
			l.append(p)
			c += p
			j += 1
		c1 = 0
		j = 0
		while j < k // 2 - 1:
			p = 2 * j + 1
			l.append(p)
			c1 += p
			j += 1
		l.append(c - c1)
		print(*l, sep=' ')


for _ in range(int(input())):
	n = int(input())
	a = []
	flag = 0
	for i in range(n // 2):
		a.append(2 * (i + 1))
	fhs = sum(a)
	for i in range(n // 2):
		x = 2 * (i + 1) - 1
		if i == n // 2 - 1:
			e = fhs * 2 - sum(a)
			if e % 2 == 0:
				print('NO')
				flag = 1
			else:
				a.append(e)
		else:
			a.append(x)
	shs = sum(a[n // 2:])
	if fhs == shs and flag == 0:
		print('YES')
		print(*a)


T = int(input())
for t in range(T):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		sumEven = 0
		for i in range(n // 2):
			tmp = 2 * (i + 1)
			sumEven += tmp
			print(tmp, end=' ')
		sumOdd = 0
		for i in range(n // 2 - 1):
			tmp = 2 * i + 1
			sumOdd += tmp
			print(tmp, end=' ')
		print(sumEven - sumOdd)


t = int(input())
for _ in range(t):
	n = int(input())
	n /= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		ans = 0
		st = ''
		for i in range(int(n)):
			ans += 2 + i * 2
			st += str(2 + i * 2)
			st += ' '
		for i in range(int(n - 1)):
			st += str(1 + i * 2)
			st += ' '
			ans -= 1 + i * 2
		st += str(ans)
		print(st)


for i in range(int(input())):
	c = int(input())
	if c // 2 % 2:
		print('NO')
	else:
		a = []
		b = []
		for j in range(2, 3 * c // 2, 3):
			if j % 2 == 1:
				b.append(j)
				a.append(j - 1)
			else:
				b.append(j - 1)
				a.append(j)
		print('YES')
		print(*a + b)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = 0
		sume = 0
		for i in range(n // 2):
			e += 2
			sume += e
			print(e, end=' ')
		o = 1
		sumo = 0
		for i in range(n // 2 - 1):
			print(o, end=' ')
			sumo += o
			o += 2
		print(sume - sumo)


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	count = 0
	count1 = 0
	if n % 4 == 0:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				count += i
				a.append(i)
		for j in range(n - 1):
			if j % 2 != 0:
				a.append(j)
				count1 += j
		a.append(count - count1)
		print(*a, sep=' ')
	else:
		print('NO')


t = int(input())
for t1 in range(t):
	n = int(input())
	if n == 2 or n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n // 2 + 1):
			print(i * 2, end=' ')
		for i in range(1, n // 2):
			print(i * 2 - 1, end=' ')
		print(n // 2 - 1 + n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cnt_zero = [0] * (2 * k + 5)
	cnt_zero_or_one = [0] * (2 * k + 5)
	(i, j) = (0, n - 1)
	while i < j:
		actual_sum = a[i] + a[j]
		cnt_zero[actual_sum] += 1
		min_sum = min(a[i], a[j]) + 1
		max_sum = max(a[i], a[j]) + k
		cnt_zero_or_one[min_sum] += 1
		cnt_zero_or_one[max_sum + 1] -= 1
		i += 1
		j -= 1
	for i in range(1, len(cnt_zero_or_one)):
		cnt_zero_or_one[i] += cnt_zero_or_one[i - 1]
	ans = 2 ** 31
	for x in range(2, len(cnt_zero_or_one)):
		cnt_one_only = cnt_zero_or_one[x] - cnt_zero[x]
		cnt_two = n / 2 - cnt_zero_or_one[x]
		ans = min(ans, cnt_one_only + cnt_two * 2)
	print(int(ans))


t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	arr = [0 for i in range(2 * k + 5)]
	l = input().split()
	li = [int(i) for i in l]
	for i in range(n // 2):
		a = min(li[i], li[n - 1 - i])
		b = max(li[i], li[n - 1 - i])
		arr[0] += 2
		arr[a + 1] -= 1
		arr[a + b] -= 1
		arr[a + b + 1] += 1
		arr[b + k + 1] += 1
	ans = n
	sumi = 0
	for i in range(2 * k + 5):
		sumi += arr[i]
		if sumi < ans:
			ans = sumi
	print(ans)


import os
import sys
from io import BytesIO, IOBase

def solution(n):
	if n * (n + 1) // 2 & 1 == 1:
		write('NO')
		return
	first = list(range(2, n + 1, 2))
	second = list(range(1, n, 2))
	sum_f = sum(first)
	sum_s = sum(second)
	while sum_f >= sum_s:
		second[-1] += 2
		sum_s += 2
		if sum_s + 2 > sum_f:
			break
	write('YES')
	write(*first + second)

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:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

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

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


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	count = {}
	d = {}
	for i in range(n // 2):
		summ = l[i] + l[n - i - 1]
		if d.get(summ):
			d[summ] += 1
		else:
			d[summ] = 1
		if count.get(summ):
			count[summ] += 1
		else:
			count[summ] = 1
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		slo = min(l[i] + 1, l[n - i - 1] + 1)
		elo = max(l[i] + k, l[n - i - 1] + k)
		pref[slo] += 1
		pref[elo + 1] -= 1
	for i in range(1, len(pref)):
		pref[i] += pref[i - 1]
	ans = n // 2
	for i in d:
		ans = min(ans, n - d[i] - pref[i])
	sys.stdout.write(str(ans) + '\n')


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	n = int(input())
	if n == 2:
		print('NO')
	elif n // 2 % 2 == 1:
		print('NO')
	else:
		res = []
		for i in range(n // 2):
			res.append(2 * (i + 1))
		t = sum(res)
		for i in range(n // 2 - 1):
			res.append(i * 2 + 1)
			t -= i * 2 + 1
		res.append(t)
		print('YES')
		print(' '.join(list(map(str, res))))


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0 or n == 2:
		print('NO')
	else:
		p = []
		num = 0
		for pd in range(n // 2):
			num += 2
			p.append(num)
		pd = sum(p)
		num = 1
		pa = 0
		for dp in range(n // 2, n):
			if dp == n - 1:
				p.append(pd - pa)
			else:
				p.append(num)
				pa += num
			num += 2
		print('YES')
		print(*p)


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		n = int(input()) // 2
		if n % 2 != 0:
			print('NO')
		else:
			print('YES')
			val = 2
			s = 0
			for i in range(n):
				print(val, end=' ')
				s += val
				val += 2
			val = 1
			for i in range(n - 1):
				print(val, end=' ')
				s -= val
				val += 2
			print(s)
main()


t = int(input())
for i in range(0, t):
	x = int(input())
	if x / 2 % 2 != 0:
		print('NO')
	else:
		lst = []
		print('YES')
		for i in range(2, x + 1):
			if i % 2 == 0:
				lst.append(i)
		y = len(lst)
		for i in range(0, y):
			if i < y / 2:
				lst.append(lst[i] - 1)
			else:
				lst.append(lst[i] + 1)
		print(*lst, sep=' ')


n = int(input())

def balanced(x):
	lst1 = list()
	for i in range(2, x + 1, 2):
		lst1.append(str(i))
	lst2 = list()
	for i in range(1, x - 1, 2):
		lst2.append(str(i))
	lst2.append(str(int(lst1[-1]) + len(lst1) - 1))
	return ' '.join(lst1) + ' ' + ' '.join(lst2)
lst1 = list()
for i in range(n):
	lst1.append(int(input()))
for i in lst1:
	if int(i / 2) % 2 == 0:
		print('YES')
		print(balanced(i))
	else:
		print('NO')


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		i = 2
		mid = n // 2 + 1
		while i < mid:
			l.append(i)
			i += 2
		i = mid + 1
		while i < n + 1:
			l.append(i)
			i += 2
		i = 1
		while i < mid:
			l.append(i)
			i += 2
		i = mid + 2
		while i <= n + 1:
			l.append(i)
			i += 2
		for i in l:
			print(i, end=' ')
		print()
t = int(input())
for i in range(t):
	solve()


def balanced_array(n):
	if n % 4 == 0:
		(m1, m2) = ([], [])
		for i in range(1, n + 1):
			if i % 2 == 0:
				m1.append(i)
			else:
				m2.append(i)
		l = len(m2) - 1
		m2[l] = m2[l] + sum(m1) - sum(m2)
		print('YES')
		print(' '.join((str(i) for i in m1 + m2)))
	else:
		print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	balanced_array(n)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2:
		print('NO')
	else:
		print('YES')
		arr = [0] * n
		arr[n // 2] = 3
		temp = 2
		for i in range(n // 2 + 1, n):
			arr[i] = arr[i - 1] + temp
			if temp == 4:
				temp = 2
			else:
				temp = 4
		arr[0] = 2
		temp = 4
		for i in range(1, n // 2):
			arr[i] = arr[i - 1] + temp
			if temp == 4:
				temp = 2
			else:
				temp = 4
		print(*arr)


import sys
input = sys.stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		(n, k) = map(int, input().split())
		arr = [int(x) for x in input().split()]
		zeromove = [0 for i in range(2 * k + 2)]
		onemove = [0 for i in range(2 * k + 2)]
		for idx in range(0, n // 2):
			zeromove[arr[idx] + arr[n - idx - 1]] += 1
			left = min(arr[idx], arr[n - idx - 1]) + 1
			right = max(arr[idx], arr[n - idx - 1]) + k
			onemove[left] += 1
			onemove[right + 1] -= 1
		ans = n
		for pairsum in range(2, 2 * k + 1):
			onemove[pairsum] += onemove[pairsum - 1]
			zero = zeromove[pairsum]
			one = onemove[pairsum] - zero
			two = n // 2 - one - zero
			ans = min(ans, one + 2 * two)
			assert one >= 0
			assert two >= 0
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	if n <= 2 or n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		m1 = 2
		m2 = 1
		a = []
		b = []
		for p in range(n // 2):
			a.append(m1)
			m1 += 2
		for p in range(n // 2 - 1):
			b.append(m2)
			m2 += 2
		b.append(sum(a) - sum(b))
		print(*a, *b)


t = int(input())
for h in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	a = []
	for i in range(n + 1):
		if i == 0 or i % 2 != 0:
			continue
		a.append(i)
	for i in range(n):
		if i % 2 == 0:
			continue
		a.append(i)
	a[-1] += n // 2
	print('YES')
	for i in a:
		print(i, end=' ')
	print()


n = int(input())
for i in range(n):
	m = int(input())
	if m % 4 == 0:
		even = []
		even2 = []
		odd = []
		for i in range(1, int(m / 2 + 1)):
			even.append(2 * i)
		for i in range(len(even)):
			if i < len(even) / 2:
				odd.append(str(even[i] - 1))
			else:
				odd.append(str(even[i] + 1))
		for i in range(1, int(m / 2 + 1)):
			even2.append(str(2 * i))
		dili = ' '
		print('YES')
		print(dili.join(even2 + odd))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = []
	if n % 4 == 0:
		for i in range(2, n // 2 + 1, 2):
			ar.append(5 * 10 ** 8 + i)
			ar.append(5 * 10 ** 8 - i)
		for i in range(1, n // 2, 2):
			ar.append(5 * 10 ** 8 + i)
			ar.append(5 * 10 ** 8 - i)
		print('YES')
		print(*ar)
	else:
		print('NO')


def balanced_array(n):
	if n % 4 != 0:
		print('No')
	else:
		arrOdd = []
		arrEven = []
		for i in range(1, n // 2 + 1):
			if i == n / 2:
				arrOdd.append(i * 2 - 1 + n // 2)
			else:
				arrOdd.append(i * 2 - 1)
		for j in range(1, n // 2 + 1):
			arrEven.append(j * 2)
		print('Yes')
		print(*arrEven, *arrOdd)
test_case = int(input())
while test_case != 0:
	n = int(input())
	balanced_array(n)
	test_case = test_case - 1


for i in range(int(input())):
	(l, s) = ([], [])
	n = int(input())
	chk = int(n / 2)
	if chk % 2 != 0:
		print('NO')
	else:
		print('YES')
		e = chk * (chk + 1)
		od = (chk - 1) * (chk - 1)
		f = e - od
		for i in range(1, n + 1):
			if i % 2 == 0:
				l.append(i)
			else:
				s.append(i)
		s.pop()
		s.append(f)
		print(*l + s)


import sys
t = int(input())
nums = []
for i in range(t):
	value = int(sys.stdin.readline().strip())
	nums.append(value)

def arrayCome(n):
	if n % 4 != 0:
		return 'No'
	left = []
	right = []
	for i in range(n // 2):
		left.append(2 * (i + 1))
	for j in range(n // 2 - 1):
		right.append(2 * (j + 1) - 1)
	right.append(sum(left) - sum(right))
	return left + right
for i in nums:
	ans = arrayCome(i)
	if ans == 'No':
		print('\n' + ans)
	else:
		print('YES', end='\n')
		for i in range(len(ans)):
			print(ans[i], end=' ')


t = int(input())
for i in range(t):
	A = []
	B = []
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		s = 0
		i = 2
		while s != n:
			A.append(i)
			if s < n / 2:
				B.append(i - 1)
			else:
				B.append(i + 1)
			s += 2
			i += 2
		print('YES')
		C = [*A, *B]
		print(*C)


n = int(input())
for j in range(0, n):
	k = int(input())
	a = int(k / 2)
	b = int(a % 2)
	li = list()
	su = 0
	if b % 2 != 0:
		print('NO')
		continue
	else:
		p = 2
		for i in range(0, a):
			li.append(p)
			su = su + p
			p = p + 2
		p = 1
		for i in range(0, a - 1):
			su = su - p
			li.append(p)
			p = p + 2
		li.append(su)
	print('YES')
	for i in range(0, len(li)):
		print(li[i], end=' ')
	print()


x = int(input())
for b in range(x):
	y = list(map(int, input().split()))
	z = list(map(int, input().split()))
	d = {}
	s1 = []
	s = sum(z) / (y[0] / 2)
	arr = [0 for i in range(int(y[1] * 2) + 2)]
	for a in range(y[0] // 2):
		s2 = z[a] + z[y[0] - a - 1]
		d[s2] = d.get(s2, 0) + 1
		arr[max(z[a], z[y[0] - a - 1]) + y[1] + 1] -= 1
		arr[min(z[a], z[y[0] - a - 1]) + 1] += 1
	for a in range(1, len(arr)):
		arr[a] += arr[a - 1]
	ans = 100000000000
	for each in d:
		ans = min(ans, arr[each] + (y[0] // 2 - arr[each]) * 2 - d[each])
	print(min(ans, max(arr) + (y[0] // 2 - max(arr)) * 2))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	if n // 2 % 2 != 0:
		print('NO')
	else:
		h = 0
		start = 2
		for i in range(n // 2):
			arr.append(start + h)
			h += 4
		arr2 = arr
		for i in range(n // 2):
			if i % 2 == 0:
				arr.append(arr2[i] - 1)
			else:
				arr.append(arr2[i] + 1)
		print('YES')
		print(*arr)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('No')
	else:
		k = n // 2
		p = 0
		se = k * (k + 1)
		e = []
		o = []
		for j in range(k):
			p = p + 2
			e.append(p)
		so = 1
		m = 1
		for j in range(k - 1):
			o.append(m)
			m += 2
		so = sum(o)
		o.append(se - so)
		e.extend(o)
		print('Yes')
		for j in range(len(e)):
			print(e[j], end=' ')
		print()


for tt in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO', end='')
	else:
		(mll, ce, o, p) = ([], 2, 1, 0)
		while p < n / 2:
			mll.append(ce)
			ce += 2
			p += 1
		(sumeven, sumod, listodd) = (sum(mll), 0, [])
		while sumod < sumeven:
			listodd.append(o)
			sumod += o
			o += 2
		if (sumod - sumeven) % 2 == 0 or sumod - sumeven not in listodd:
			print('NO', end='')
		else:
			listodd.remove(sumod - sumeven)
			print('YES')
			for i in mll:
				print(i, end=' ')
			for i in listodd:
				print(i, end=' ')
	print()


T = int(input())
results = []
results2 = []
for case in range(1, T + 1):
	n = int(input())
	if n // 2 % 2 == 1:
		results.append('NO')
	else:
		arr = []
		su = 0
		for i in range(n // 2):
			num = (i + 1) * 2
			su += num
			arr.append(num)
		su2 = 0
		for i in range(n // 2 - 1):
			num = i * 2 + 1
			su2 += num
			arr.append(num)
		arr.append(su - su2)
		results.append('YES')
		results2.append(arr)
for result in results:
	print(result)
	if result == 'YES':
		print(' '.join([str(i) for i in results2.pop(0)]))


for _ in range(int(input())):
	n = int(input())
	l = []
	if n % 4 != 0:
		print('NO')
	else:
		even = [int(x) for x in range(2, n + 1, 2)]
		odd = [int(x) for x in range(1, n - 1, 2)]
		odd.append(sum(even) - sum(odd))
		newlst = even + odd
		print('YES')
		print(*newlst)


import sys
t = int(input())
for i in range(t):
	n = int(input())
	even = []
	odd = []
	if n % 4 != 0:
		print('NO')
	elif n % 4 == 0:
		print('YES')
		for j in range(1, n + 1):
			if j % 2 == 0:
				even.append(str(j))
			else:
				odd.append(str(j))
		odd[n // 2 - 1] = str(int(odd[n // 2 - 1]) + n // 2)
		print(' '.join(even) + ' ' + ' '.join(odd))


n = int(input())
for _ in range(n):
	s = int(input())
	if s % 4 != 0:
		print('NO')
	else:
		print('YES')
		li = []
		for i in range(1, s // 2 + 1):
			li.append(i * 2)
		s1 = sum(li)
		li2 = []
		for i in range(s // 2 - 1):
			li2.append(i * 2 + 1)
		s2 = sum(li2)
		li = li + li2
		li.append(s1 - s2)
		print(*li, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	p = n // 2
	if p % 2 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		su = 0
		for i in range(p):
			s = (i + 1) * 2
			print(s, end=' ')
			sum = sum + s
		for i in range(1, p):
			s = 2 * i - 1
			print(s, end=' ')
			su = su + s
		print(sum - su)


tc = int(input())
for _ in range(tc):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		h = [[], []]
		(l, r) = (1, n + 1)
		i = 1
		while l != r:
			h[i] += [l, r]
			l += 1
			r -= 1
			i = 1 - i
		a = h[0] + h[1]
		print(' '.join(map(str, a)))
	else:
		print('NO')


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
while t:
	t -= 1
	n = int(inp().strip())
	if n / 2 % 2 == 0:
		print('YES')
		temp = [i for i in range(2, n + 1, 2)]
		temp2 = [i for i in range(1, n - 2, 2)]
		print(*temp, *temp2, sum(temp) - sum(temp2))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = []
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		e = 0
		for i in range(n // 2):
			e += 2
			s.append(e)
		o = 1
		for j in range(n // 4):
			s.append(o)
			o += 2
		for k in range(n // 4):
			o += 2
			s.append(o)
	for i in s:
		print(i, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		ans = []
		for i in range(2, 2 * (n + 1), 4):
			ans.append(i)
		flag = False
		n = len(ans)
		for i in range(n):
			if flag == False:
				ans.append(ans[i] - 1)
				flag = True
			elif flag == True:
				ans.append(ans[i] + 1)
				flag = False
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()


t = int(input())
n = []
while t > 0:
	t -= 1
	n.append(int(input()))
out = []
for i in n:
	if i // 2 % 2 != 0:
		out.append('N')
	else:
		a = []
		for j in range(2, i + 1, 2):
			a.append(j)
		for j in range(1, i - 2, 2):
			a.append(j)
		a.append(i - 1 + i // 2)
		out.append(('YES', a))
for i in out:
	if len(i) == 1:
		print('NO')
	else:
		print(i[0])
		t = list(map(str, i[1]))
		print(' '.join(t))


from __future__ import division, print_function
import os
import 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 main():
	t = inp()
	for i in range(t):
		solve()

def solve():
	nk = inlt()
	n = nk[0]
	k = nk[1]
	lst = inlt()
	count_map = {}
	prefs = [0] * (2 * k + 2)
	for i in range(n // 2):
		a = lst[i]
		b = lst[n - i - 1]
		s = a + b
		count_map[s] = count_map.get(s, 0) + 1
		start = min(a, b) + 1
		end = max(a, b) + k + 1
		prefs[start] += 1
		prefs[end] -= 1
	sums = []
	total = 0
	for num in prefs:
		total += num
		sums.append(total)
	min_len = n
	for x in range(2, 2 * k + 1):
		cur = sums[x] - count_map.get(x, 0) + (n // 2 - sums[x]) * 2
		min_len = min(min_len, cur)
	print(min_len)
BUFSIZE = 8192

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())

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 i in range(t):
	n = int(input())
	ans = []
	even = 2
	odd = 1
	smeven = 0
	smodd = 0
	m = n // 2
	if m % 2:
		print('NO')
	else:
		for j in range(m):
			ans.append(even)
			smeven += even
			even += 2
		for j in range(m):
			ans.append(odd)
			smodd += odd
			odd += 2
		res = smeven - smodd
		ans[-1] = ans[-1] + res
		print('YES')
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		e = []
		o = []
		for x in range(1, n + 1):
			if x % 2 == 0:
				e.append(x)
			else:
				o.append(x)
		o[n // 2 - 1] = o[n // 2 - 1] + n // 2
		for ee in e:
			print(ee, end=' ')
		for oo in o:
			print(oo, end=' ')
		print()


t = int(input())
for d in range(t):
	n = int(input())
	arr = []
	sume = 0
	sumo = 0
	if n % 2 != 0:
		print('NO')
	elif n // 2 % 2 != 0:
		print('NO')
	elif n % 2 == 0:
		print('YES')
		for i in range(n // 2):
			a = 2 * (i + 1)
			arr.append(a)
			sume = sume + a
		for i in range(n // 2 - 1):
			o = 2 * (i + 1) - 1
			arr.append(o)
			sumo = sumo + o
		arr.append(sume - sumo)
		for i in range(len(arr)):
			print(arr[i], end=' ')


for i in range(int(input())):
	n = int(input())
	first = 2
	last = 1
	if n % 4 == 0:
		print('YES')
		for j in range(n // 2):
			print(first, end=' ')
			first += 2
		for j in range(n // 2 + 1):
			if j == n / 4:
				last += 2
				continue
			else:
				print(last, end=' ')
				last += 2
	else:
		print('NO', end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	ans = []
	res = []
	m = n // 2
	if m % 2 == 0:
		print('YES')
		for i in range(1, m + 1):
			ans.append(2 * i)
		suma = sum(ans)
		c = m - 1
		j = 1
		while c:
			ans.append(j)
			res.append(j)
			j += 2
			c -= 1
		sumb = sum(res)
		k = suma - sumb
		ans.append(k)
		result = ' '.join(map(str, ans))
		print(result)
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		h = int(n / 2)
		e = 2
		even = []
		odd = []
		for i in range(h):
			even.append(e)
			e += 2
		for i in range(h - 1):
			odd.append(even[i] - 1)
		odd.append(even[h - 1] + h - 1)
		print(*even, *odd)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		even = [i for i in range(2, n + 1, 2)]
		odd = [i for i in range(1, n - 2, 2)]
		odd.append(n // 2 - 1 + n)
		print(*even, *odd)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	if n // 2 % 2 == 1:
		print('NO')
	else:
		ans = []
		for i in range(2, n + 1, 2):
			ans.append(i)
		for i in range(1, n - 1, 2):
			ans.append(i)
		ans.append(sum(ans[:n // 2]) - sum(ans[n // 2:]))
		print('YES')
		print(*ans)
for _ in range(int(input())):
	case()


t = int(input())
while t:
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = 2
		b = 4
		for i in range(n // 4):
			print(a, end=' ')
			print(b, end=' ')
			a += 6
			b += 6
		a = 1
		b = 5
		for i in range(n // 4):
			print(a, end=' ')
			print(b, end=' ')
			a += 6
			b += 6
		print()
	t -= 1


for i in range(int(input())):
	a = int(input())
	if a / 2 % 2 == 1:
		print('NO')
	else:
		z = [2 * x for x in range(1, int(a / 2) + 1)]
		q = sum(z)
		count = 1
		while q > 0:
			if a - len(z) == 1:
				z.append(q)
				break
			z.append(count)
			q -= count
			count += 2
		print('YES')
		print(' '.join(map(str, z)))


from collections import deque
from collections import Counter
from itertools import permutations
import heapq

def counterExample():
	arr = [1, 3, 4, 1, 2, 1, 1, 3, 4, 3, 5, 1, 2, 5, 3, 4, 5]
	counter = Counter(arr)
	top_three = counter.most_common(3)
	print(top_three)
q = deque()

def main():
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			print('YES')
			a = [i * 2 for i in range(1, n // 2 + 1)]
			b = [i * 2 - 1 for i in range(1, n // 2)]
			b.append(b[n // 2 - 2] + n // 2 + 2)
			a.extend(b)
			print(' '.join([str(i) for i in a]))
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	b = []
	if n % 4:
		print('NO')
	else:
		print('YES')
		for j in range(n // 4):
			a.append(6 * j + 2)
			a.append(6 * j + 4)
			b.append(6 * j + 1)
			b.append(6 * j + 5)
		a = [str(k) for k in a]
		b = [str(k) for k in b]
		has = a + b
		print(' '.join(has))


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')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		outev = [2 * k for k in range(1, n // 2 + 1)]
		outod = [2 * k - 1 for k in range(1, n // 2 + 1)]
		diff = sum(outev) - sum(outod)
		outod[-1] += diff
		outods = [str(k) for k in outod]
		outevs = [str(k) for k in outev]
		output = outevs + outods
		print(' '.join(output))
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	sum1 = 0
	sum2 = 0
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		n = int(n / 2)
		k = 0
		j = 2
		while k < n:
			print(j, end=' ')
			j = j + 2
			k = k + 1
		sum1 = n * (n + 1)
		j = 1
		k = 0
		while k < n - 1:
			print(j, end=' ')
			j = j + 2
			k = k + 1
			sum2 = (n - 1) * (n - 1)
		print(sum1 - sum2)


k = int(input())
for ki in range(k):
	t = int(input())
	if t // 2 % 2 != 0:
		print('NO')
	else:
		left = []
		right = []
		for i in range(0, t // 2):
			left.append((i + 1) * 2)
			right.append((i + 1) * 2 - 1)
		right.pop()
		right.append(sum(left) - sum(right))
		print('YES')
		res = left + right
		for r in res:
			print(r, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		s = ''
		for i in range(1, n // 2 + 1):
			s += str(i * 2)
			s += ' '
		for j in range(1, (n // 2 - 1) * 2, 2):
			s += str(j)
			s += ' '
		k = (n // 2 - 1) * 2 * (n // 2 - 1) // 2
		s += str((2 + n) * (n // 2) // 2 - k)
		print(s)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		li1 = [i for i in range(2, n + 1, 2)]
		for ele in li1:
			print(ele, end=' ')
		s = sum(li1)
		a = 1
		li2 = []
		for i in range(len(li1) - 1):
			li2.append(a)
			a = a + 2
		for ele in li2:
			print(ele, end=' ')
		print(s - sum(li2))
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	if n // 2 % 2:
		print('NO')
		continue
	else:
		print('YES')
		ans = []
		for i in range(1, n // 2 + 1):
			ans.append(2 * i)
		for i in range(n // 4):
			ans.append(ans[i] - 1)
		for i in range(n // 4, n // 2):
			ans.append(ans[i] + 1)
		print(*ans)


from sys import stdin
debug = False

def join(_s, _l):
	return _s.join(map(str, _l))

def read(_f=None):
	if _f == None:
		return stdin.readline().strip()
	return _f(stdin.readline().strip())

def readlist(_f=None):
	_l = stdin.readline().strip().split()
	if _f == None:
		return _l
	return map(_f, _l)
readint = lambda : read(int)
readints = lambda : readlist(int)
printval = lambda _r: print(_r, end=' ')
printline = lambda _s, _r: print(join(_s, _r), end='\n')

def solve():
	n = readint()
	nums = n // 2
	if nums % 2 == 0:
		first = [0] * nums
		second = [0] * nums
		number = 2
		for i in range(nums):
			first[i] = number
			if i % 2 == 0:
				second[i] = number - 1
			else:
				second[i] = number + 1
			number += 4
		return (True, first + second)
	else:
		return (False, [])
t = readint()
for _ in range(t):
	if debug:
		print('-' * 20)
	if debug:
		print('ANS: ', end='')
	(possible, array) = solve()
	if possible:
		print('YES')
		printline(' ', array)
	else:
		print('NO')


import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right

def solution(n):
	li = []
	s = 0
	ele = 2
	for i in range(n // 2):
		s += ele
		li.append(ele)
		ele += 2
	s1 = 0
	ele = 1
	for i in range(n // 2 - 1):
		s1 += ele
		li.append(ele)
		ele += 2
	left = s - s1
	if left % 2 != 0:
		li.append(left)
		return li
	return []

def input_test():
	for _ in range(int(input())):
		n = int(input())
		out = solution(n)
		if out:
			print('YES')
			print(*out)
		else:
			print('NO')

def test():
	pass
input_test()


for _ in range(int(input())):
	n = int(input())
	a = n // 2
	if a == 1:
		print('NO')
	else:
		a2 = a * (a + 1)
		c = (a - 1) * (a - 1)
		if (a2 - c) % 2 != 0:
			print('YES')
			for i in range(0, n, 2):
				print(i + 2, end=' ')
			for j in range(1, n - 1, 2):
				print(j, end=' ')
			print(a2 - c)
		else:
			print('NO')


def build_array(length):
	array = []
	half_length = int(length / 2)
	odd = 1
	even = 2
	deltas = [4, 2]
	for i in range(half_length):
		array.append(even)
		even += deltas[(i + 1) % 2]
	for i in range(half_length):
		array.append(odd)
		odd += deltas[i % 2]
	return array
test_size = int(input())
for i in range(test_size):
	cur_test = int(input())
	if cur_test / 2 % 2 == 0:
		print('YES')
		result_array = build_array(cur_test)
		result_string = map(str, result_array)
		print(' '.join(result_string))
	else:
		print('NO')


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 // 2 % 2 != 0:
		print('NO')
	else:
		arr = []
		even = odd = 0
		for i in range(2, n + 1, 2):
			arr.append(i)
			even += i
		for i in range(1, n - 1, 2):
			arr.append(i)
			odd += i
		remain = even - odd
		arr.append(remain)
		print('YES')
		print(*arr)


n = int(input())
for i in range(n):
	t = int(input())
	if t % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		m = t // 2
		(a, b, diff) = (2, 1, 0)
		for j in range(m):
			l.append(a)
			a += 2
		for k in range(m - 1):
			l.append(b)
			b += 2
		for r in range(m - 1):
			diff += l[r] - l[m + r]
		g = l[m - 1] + diff
		l.append(g)
		for ch in l:
			print(ch, end=' ')
		print()


t = int(input())
while t != 0:
	n = int(input())
	arr = []
	if n % 4 != 0:
		print('NO')
	else:
		arr = [x for x in range(2, n + 1, 2)]
		arr.extend([x for x in range(1, n, 2)])
		arr[-1] += n // 2
		print('YES')
		print(*arr)
	t -= 1


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	t = int(input())
	ans = [''] * t
	for ti in range(t):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		pair_cnt = n >> 1
		ub = k * 2 + 1
		cost1 = [0] * (ub + 1)
		cost2 = [0] * (ub + 1)
		cnt = [0] * (ub + 1)
		for i in range(n >> 1):
			(x, y) = (a[i], a[-i - 1])
			if x > y:
				(x, y) = (y, x)
			cost1[k + y + 1] += 1
			cost2[x] += 1
			cnt[x + y] += 1
		for i in range(ub):
			cost1[i + 1] += cost1[i]
		for i in range(ub, 0, -1):
			cost2[i - 1] += cost2[i]
		mincost = 10 ** 9
		for i in range(1, ub + 1):
			c = cost1[i] + cost2[i] + (pair_cnt - cnt[i])
			if mincost > c:
				mincost = c
		ans[ti] = str(mincost)
	sys.stdout.buffer.write(('\n'.join(ans) + '\n').encode('utf-8'))
main()


a = int(input())
for i in range(0, a):
	b = int(input())
	if b % 4 == 0:
		print('YES')
		k = []
		sm1 = 0
		sm2 = 0
		for j in range(0, int(b / 2)):
			k.append((j + 1) * 2)
			sm1 += (j + 1) * 2
		for j in range(0, int(b / 2) - 1):
			k.append((j + 1) * 2 - 1)
			sm2 += (j + 1) * 2 - 1
		k.append(sm1 - sm2)
		for kk in k:
			print(kk, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	k = int(input()) // 2
	if k % 2:
		print('NO')
	else:
		print('YES')
		r = [i for i in range(2, 2 * k + 1, 2)] + [i - 1 for i in range(2, k + 1, 2)] + [i + 1 for i in range((1 + k // 2) * 2, 2 * k + 1, 2)]
		print(*r)


a = int(input())
for _ in range(a):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		sum = 0
		sum1 = 0
		x = 2
		for i in range(int(n / 2)):
			print(x, end=' ')
			sum += x
			x += 2
		x = 1
		for i in range(int(n / 2) - 1):
			print(x, end=' ')
			sum1 += x
			x += 2
		d = sum - sum1
		print(d, end=' ')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print('NO')
	elif n == 2:
		print('NO')
	else:
		l = []
		r = []
		ls = 0
		rs = 0
		for j in range(1, n // 2 + 1):
			l.append(2 * j)
		for j in range(len(l)):
			ls += l[j]
		for j in range(len(l) - 1):
			r.append(2 * j + 1)
		for j in range(len(r)):
			rs += r[j]
		if (ls - rs) % 2 == 0 or ls - rs in r or ls - rs < 0:
			print('NO')
		else:
			print('YES')
			r.append(ls - rs)
			l.extend(r)
			for j in range(len(l)):
				print(l[j], end=' ')
			print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		for i in range(1, n * 2):
			l.append(i)
		list1 = []
		list2 = []
		for k in range(n // 4):
			list1.append(l[k * 8 + 1])
			list1.append(l[k * 8 + 5])
			list2.append(l[k * 8 + 2])
			list2.append(l[k * 8 + 4])
		print(' '.join((str(u) for u in list1 + list2)))


import random
t = int(input())
for _ in range(t):
	n = int(input())
	mid = n // 2
	arr = []
	num = 2
	sumOfEven = 0
	for pos in range(mid):
		arr.append(num)
		sumOfEven += num
		num += 2
	sumOfOdd = 0
	a = 1
	yesOrNo = ''
	for pos in range(mid - 1):
		arr.append(a)
		sumOfOdd += a
		a += 2
	if (sumOfEven - sumOfOdd) % 2 == 0 or sumOfOdd == 0:
		print('NO')
	else:
		print('YES')
		arr.append(sumOfEven - sumOfOdd)
		for num in arr:
			print(num, end=' ')
		print('')


t = int(input())
for i in range(t):
	n = int(input())
	s = n // 2
	if s % 2 != 0:
		print('NO')
	else:
		print('YES')
		odd = []
		odds = 0
		evens = 0
		even = []
		for k in range(1, n + 1):
			if k % 2 == 0:
				even.append(k)
				evens += k
			elif k % 2 != 0 and k != n - 1:
				odd.append(k)
				odds += k
		if evens > odds:
			odd.append(evens - odds)
		even.extend(odd)
		for k in even:
			print(k, end=' ')


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


t = int(input())
lst = []
for i in range(1, t + 1):
	n = int(input())
	lst.append(n)
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		print(*range(2, n + 1, 2), *range(1, n - 1, 2), 3 * n // 2 - 1)


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = []
		a = 0
		c = 0
		b = 0
		for i in range(2, n + 1, 2):
			a += i
			l.append(i)
		for i in range(1, n + 2, 2):
			if i == n - 1:
				continue
			c += 1
			if c == n // 2:
				l.append(a - b)
				continue
			b += i
			l.append(i)
		print('YES')
		print(*l)


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	(n, k) = map(int, input().split())
	arr = [int(i) for i in input().split()]
	d = {}
	for i in range(n // 2):
		x = arr[i] + arr[n - i - 1]
		if x not in d:
			d[x] = 1
		else:
			d[x] += 1
	prefix = [0 for i in range(2 * k + 50)]
	for i in range(n // 2):
		l = min(arr[i], arr[n - i - 1]) + 1
		h = max(arr[i], arr[n - i - 1]) + k
		prefix[l] += 1
		prefix[h + 1] -= 1
	s = 0
	for i in range(2, 2 * k + 1):
		s += prefix[i]
		prefix[i] = s
	fans = 10 ** 10
	for i in range(2, 2 * k + 1):
		c0 = 0
		if i in d:
			c0 = d[i]
		c1 = prefix[i] - c0
		c2 = n // 2 - c1 - c0
		total = c1 + c2 * 2
		fans = min(fans, total)
	print(fans)


def solve(n):
	if n // 2 % 2 != 0:
		return (False, None)
	first = [2]
	second = [1]
	for _ in range(n // 2 - 1):
		first.append(first[-1] + 2)
		second.append(second[-1] + 2)
	second[-1] = 0
	second[-1] = sum(first) - sum(second)
	return (True, first + second)
t = int(input())
for _ in range(t):
	n = int(input())
	(b, sol) = solve(n)
	print('YES' if b else 'NO')
	if b:
		print(' '.join(map(str, sol)))


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		L = []
		for i in range(0, n // 2):
			L.append(2 * i + 2)
		for i in range(n // 2, n - 1):
			L.append(2 * (i - n // 2) + 1)
		L.append(3 * n // 2 - 1)
		print('YES')
		print(*L)


testcase = int(input())
for _ in range(0, testcase):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		array = list()
		for i in range(2, n + 1, 2):
			array.append(i)
		count = 0
		a = n // 2
		for i in range(2, n + 1, 2):
			if count < a // 2:
				array.append(i - 1)
				count += 1
			else:
				array.append(i + 1)
			if count == a // 2 + a // 2:
				count = 0
		for j in array:
			print(str(j), end=' ')
	else:
		print('NO')


t = int(input())
for _ in range(0, t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('no')
	else:
		print('yes')
		j = 2
		for i in range(0, n // 2):
			print(int(j), end=' ')
			j = j + 2
		val = j - 2
		j = 1
		for i in range(1, n // 2):
			print(j, end=' ')
			j = j + 2
		print(int(val) + (n // 2 - 1), end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	s = n // 2
	if n % 4 != 0:
		print('NO')
	else:
		r = [2]
		for i in range(1, s):
			r.append(r[i - 1] + 2)
		o = [1]
		for i in range(1, s):
			o.append(o[i - 1] + 2)
		o[len(o) - 1] += n // 2
		print('YES')
		print(*r + o)


p = int(input())
for z in range(p):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		a = []
		s1 = 0
		s2 = 0
		for i in range(1, n // 2 + 1):
			a.append(i * 2)
			s1 += i * 2
		for i in range(1, n // 2):
			a.append(i * 2 - 1)
			s2 += i * 2 - 1
		a.append(s1 - s2)
		print('YES')
		print(*a)


import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, UserDict, defaultdict, deque, namedtuple
from functools import cmp_to_key, lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, combinations_with_replacement, permutations, product
sys.setrecursionlimit(10 ** 5 + 1)
input = sys.stdin.buffer.readline
MOD = 10 ** 9 + 7

def f(k):
	return 2 ** k - 1
T = int(input())
for _ in range(T):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		half = n // 2
		nums = list(range(2, n + 1, 2)) + list(range(1, n - 1, 2)) + [n - 1 + half]
		print(*nums)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	sum = 0
	sum1 = 0
	print('YES')
	for j in range(2, n + 1, 2):
		print(j, end=' ')
		sum += j
	for j in range(1, n - 1, 2):
		print(j, end=' ')
		sum1 += j
	print(sum - sum1)


from sys import stdin
from functools import lru_cache, cmp_to_key
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
from collections import Counter, deque
from bisect import bisect_left, bisect_right

def solver():
	line = stdin.readline()
	[n, k] = [*map(int, line.split())]
	line = stdin.readline()
	nums = [*map(int, line.split())]
	(mn, mx, sum) = ([], [], [])
	for i in range(n // 2):
		mn.append(min(nums[i], nums[n - 1 - i]))
		mx.append(max(nums[i], nums[n - 1 - i]))
		sum.append(nums[i] + nums[n - 1 - i])
	mn.sort()
	mx.sort()
	cnt = [n // 2] * (2 * k + 1)
	for i in range(k + 1):
		pos = bisect_left(mn, i)
		cnt[i] += n // 2 - pos
	for i in range(k + 1, k * 2 + 1):
		pos = bisect_left(mx, i - k)
		cnt[i] += pos
	for i in sum:
		cnt[i] -= 1
	res = min(cnt)
	print('{}'.format(res))

def main():
	T = int(stdin.readline())
	for case_num in range(T):
		solver()
main()


for _ in range(int(input())):
	n = int(input())
	ans = []
	if n % 4 != 0:
		print('NO')
	else:
		ach = 0
		for i in range(2, n + 1, 2):
			ans.append(str(i))
			ach += i
		cnt = int(n)
		tsum = 0
		for i in range(1, n - 1, 2):
			tsum += i
			ans.append(str(i))
			x = i
		while tsum < ach:
			x += 2
			if tsum + x == ach:
				ans.append(str(x))
				break
		print('YES')
		print(' '.join(ans))


import sys

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		n = n // 2
		a = [-1] * 2 * n
		se = 0
		so = 0
		for i in range(1, n + 1):
			a[i - 1] = 2 * i
			se += 2 * i
			a[i + n - 1] = 2 * i - 1
			so += 2 * i - 1
		a[-1] += se - so
		print(*a)


from sys import stdin, stdout

def constant_palindrome_sum(n, k, a):
	sasum = [0 for i in range(2 * k + 2)]
	acsum = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		lv = min(a[i], a[n - i - 1]) + 1
		hv = max(a[i], a[n - i - 1]) + k
		acsum[lv] += 1
		acsum[hv + 1] -= 1
		sasum[a[i] + a[n - i - 1]] += 1
	res = 2 ** 31 - 1
	cnt = 0
	for i in range(2, 2 * k + 1):
		cnt += acsum[i]
		res = min(res, cnt - sasum[i] + (n // 2 - cnt) * 2)
	return res

def bs_rb(v, ar):
	l = 0
	h = len(ar) - 1
	while l < h:
		m = (l + h) // 2
		if v <= ar[m][1]:
			h = m
		else:
			l = m + 1
	return h

def bs_lb(v, ar):
	l = 0
	h = len(ar) - 1
	while l < h:
		m = (l + h + 1) // 2
		if v >= ar[m][0]:
			l = m
		else:
			h = m - 1
	return l
t = int(stdin.readline())
for i in range(t):
	nk = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	stdout.write(str(constant_palindrome_sum(nk[0], nk[1], a)) + '\n')


t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for i in range(t):
	if a[i] / 2 % 2 != 0:
		if i != 0:
			print('\nNO')
		else:
			print('NO')
	else:
		b = []
		sum1 = 0
		sum2 = 0
		print('YES')
		for j in range(1, a[i] // 2 + 1):
			b.append(2 * j)
			sum1 += 2 * j
		for j in range(1, a[i] // 2):
			b.append(2 * j - 1)
			sum2 += 2 * j - 1
		b.append(sum1 - sum2)
		for k in range(a[i]):
			print(b[k], end=' ')


t = int(input())
i = 0
while i < t:
	n = int(input())
	a = n // 2
	if a % 2 == 0:
		print('YES')
		j = 0
		res1 = 0
		sum1 = 0
		while j < a:
			print(res1 + 2, end=' ')
			res1 = res1 + 2
			sum1 = sum1 + res1
			j = j + 1
		j = 0
		sum2 = 0
		res = -1
		while j < a - 1:
			res = res + 2
			print(res, end=' ')
			sum2 = sum2 + res
			j = j + 1
		print(sum1 - sum2)
	else:
		print('NO')
	i = i + 1


for test in range(int(input())):
	n = int(input())
	e = []
	o = []
	if n // 2 % 2 == 0:
		print('YES')
		for i in range(1, n + 1):
			if i % 2 == 0:
				e.append(i)
			else:
				o.append(i)
		o[n // 2 - 1] = o[n // 2 - 1] + n // 2
		print(*e + o, sep=' ')
	else:
		print('NO')


def solve():
	n = int(input())
	if n % 4 == 2:
		print('NO')
		return
	print('YES')
	A = [2 * i for i in range(1, n // 2 + 1)]
	for i in range(1, n // 2):
		A.append(2 * i - 1)
	A.append(n + n // 2 - 1)
	print(*A)
	return
t = int(input())
for i in range(t):
	solve()


from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	ch = 1
	h = n // 2
	a = []
	b = []
	if h % 2 == 1:
		ch = 0
	else:
		for i in range(1, h + 1):
			a.append(2 * i)
		for i in range(1, h):
			a.append(2 * i - 1)
		a.append(2 * h - 1 + h)
	if ch == 0:
		print('NO')
	else:
		print('YES')
		print(*a)


T = int(input())
while T > 0:
	T = T - 1
	(N, K) = map(int, input().split(' '))
	nums = list(map(int, input().split(' ')))
	sums = [0] * (2 * K + 1)
	prefs = [0] * (2 * K + 2)
	i = 0
	terms = int(N / 2)
	while i < terms:
		curr_ind = i * 2
		curr = nums[curr_ind] + nums[N - curr_ind - 1]
		sums[curr] = sums[curr] + 1
		minim = 1 + min(nums[curr_ind], nums[N - curr_ind - 1])
		maxim = K + max(nums[curr_ind], nums[N - curr_ind - 1])
		prefs[minim] = prefs[minim] + 1
		prefs[maxim + 1] = prefs[maxim + 1] - 1
		i = i + 1
	i = 1
	while i < len(prefs):
		prefs[i] = prefs[i] + prefs[i - 1]
		i = i + 1
	i = 1
	cost = -1
	while i < len(sums):
		now_cost = sums[i] * 0 + (prefs[i] - sums[i]) + (terms - prefs[i]) * 2
		if cost == -1 or now_cost < cost:
			cost = now_cost
		i = i + 1
	print(cost)


import sys
import math
from collections import defaultdict

def solve(t):
	n = int(input())
	m = n // 2
	if m & 1:
		print('NO')
	else:
		even = 2
		first = []
		second = []
		for i in range(m):
			first.append(str(even))
			if i < m // 2:
				second.append(str(even - 1))
			else:
				second.append(str(even + 1))
			even += 2
		res = first + second
		print('YES')
		print(' '.join(res))
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


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 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):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	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())
	a = [0] * n
	start = 2
	for i in range(n // 2):
		a[i] = start
		start += 2
	count = 0
	for i in range(n // 2):
		a[n // 2 + i] = a[i] - 1
	a[-1] = a[n // 2 - 1] + n // 2 - 1
	if sum(a[:n // 2]) == sum(a[n // 2:]) and a[-1] % 2 != 0:
		print('YES')
		print(*a)
	else:
		print('NO')


from math import sqrt
from queue import Queue
import sys
sys.setrecursionlimit(10 ** 6)
nokfase = int(input())
for kase in range(nokfase):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	print('YES')
	m = n // 2
	for i in range(1, m + 1):
		print(i + i, end=' ')
	for i in range(m - 1):
		print(i + i + 1, end=' ')
	print(3 * m - 1)


q = int(input())
for _ in range(q):
	(n, k) = list(map(int, input().split(' ')))
	arr = list(map(int, input().split(' ')))
	ans = [0 for i in range(2 * k + 1)]
	if n == 2:
		print(0)
		continue
	for j in range(n // 2):
		(x, y) = (arr[j], arr[n - 1 - j])
		mid = x + y
		endr = max(x, y) + k
		endl = min(x, y) + 1
		if mid < endr:
			ans[mid + 1] += 1
			if endr < 2 * k:
				ans[endr + 1] += 1
		if endl < mid:
			ans[endl] += 1
			ans[mid] -= 1
			if 2 < endl:
				ans[2] += 2
				ans[endl] -= 2
	for i in range(1, 2 * k + 1):
		ans[i] += ans[i - 1]
	(ans[0], ans[1]) = (float('inf'), float('inf'))
	print(min(ans))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		c = [f for f in range(2, n // 2 * 2 + 1, 2)]
		nc = []
		for j in range(n // 2):
			if j == n // 2 - 1:
				nc.append(sum(c) - sum(nc))
			else:
				nc.append(c[j] - 1)
		c = ''.join(list(map(lambda x: f'{x} ', c)))
		nc = ''.join(list(map(lambda x: f'{x} ', nc)))
		print('YES')
		print((c + nc)[:-1])
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	even = []
	odd = []
	for i in range(1, 1 + n):
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	evens_sum = sum(even)
	odd_sum = sum(odd)
	if (evens_sum - odd_sum) % 2 == 0:
		odd[-1] = odd[-1] + (evens_sum - odd_sum)
	if sum(even) == sum(odd):
		res = even + odd
		print('YES')
		print(*res)
	else:
		print('NO')


t = int(input())
arrays = []
for _ in range(t):
	n = int(input())
	ar = []
	al = []
	a = []
	f = -1
	if n / 2 % 2 == 1:
		arrays.append([])
	else:
		for i in range(2, n + 1, 2):
			al.append(i)
			if i <= n // 2:
				ar.append(i - 1)
			else:
				ar.append(i + 1)
		a = al + ar
		arrays.append(a)
for arr in arrays:
	if len(arr) == 0:
		print('NO')
	else:
		print('YES')
		print(*arr)


from math import *
test = int(input())
for test_case in range(test):
	n = int(input())
	ans = []
	s = 0
	for i in range(1, n // 2 + 1):
		ans.append(i * 2)
		s += i * 2
	for i in range(1, n // 2):
		ans.append(i * 2 - 1)
		s -= i * 2 - 1
	if s % 2 == 0:
		print('NO')
		continue
	else:
		ans.append(s)
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()


a = []
b = []
for i in range(1, 400005):
	if i % 2 == 0:
		a.append(i)
	else:
		b.append(i)
t = int(input())
while t:
	j = []
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(int(n / 2)):
			j.append(a[i])
		for i in range(int(n / 2)):
			if i == int(n / 2) - 1:
				j.append(b[i] + int(n / 2))
			else:
				j.append(b[i])
		for h in j:
			print(h, end=' ')
	t = t - 1


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	if n % 4 != 0:
		stdout.write('NO\n')
	else:
		stdout.write('YES\n')
		for i in range(2, n + 1, 2):
			stdout.write(str(i) + ' ')
		for i in range(1, n - 2, 2):
			stdout.write(str(i) + ' ')
		stdout.write(str((3 * n - 2) // 2) + '\n')


import sys
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lim = 2 * k + 2
	l = list(map(int, input().split()))
	(cnt, val) = ([0] * lim, [0] * lim)
	for i in range(n // 2):
		(a, b) = (l[i], l[n - i - 1])
		cnt[a + b] += 1
		val[max(a + k, b + k) + 1] -= 1
		val[min(a + 1, b + 1)] += 1
	ans = 10 ** 12
	for i in range(1, 2 * k + 1):
		val[i] += val[i - 1]
	for s in range(2, lim):
		ans = min(ans, val[s] - cnt[s] + 2 * (n // 2 - val[s]))
	print(ans)


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	if n == 2:
		print(0)
	else:
		count = [0] * (2 * k)
		for j in range(n // 2):
			count[arr[j] + arr[-j - 1] - 1] += 1
		pref = [0] * (2 * k)
		for j in range(n // 2):
			x1 = arr[j] + 1
			x2 = arr[-j - 1] + 1
			y1 = arr[j] + k
			y2 = arr[-j - 1] + k
			pref[min(x1, x2) - 1] += 1
			if max(y1, y2) < 2 * k:
				pref[max(y1, y2)] -= 1
		for j in range(1, 2 * k):
			pref[j] += pref[j - 1]
		ans = n // 2
		for j in range(1, 2 * k):
			temp = pref[j] - count[j] + 2 * (n // 2 - pref[j])
			ans = min(ans, temp)
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	data = list(map(int, input().split()))
	in_map = {}
	out_map = {}
	sum_map = {}
	points = set()
	for i in range(n // 2):
		min_value = min(data[i], data[n - i - 1])
		max_value = max(data[i], data[n - i - 1])
		lower_bound = min_value + 1
		upper_bound = max_value + k
		sum_value = min_value + max_value
		if lower_bound in in_map:
			in_map[lower_bound] += 1
		else:
			in_map[lower_bound] = 1
		if upper_bound in out_map:
			out_map[upper_bound] += 1
		else:
			out_map[upper_bound] = 1
		if sum_value in sum_map:
			sum_map[sum_value] += 1
		else:
			sum_map[sum_value] = 1
		points.add(lower_bound)
		points.add(upper_bound)
		points.add(sum_value)
	points = sorted(points)
	now_sum = 0
	result = n
	for i in points:
		in_count = 0
		if i in in_map:
			in_count = in_map[i]
		now_sum += in_count
		sum_count = 0
		if i in sum_map:
			sum_count = sum_map[i]
		now_total = n - (now_sum + sum_count)
		result = min(result, now_total)
		out_count = 0
		if i in out_map:
			out_count = out_map[i]
		now_sum -= out_count
	print(result)


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		res = []
		p1 = 2
		p2 = 4
		p3 = 1
		p4 = 5
		bb = [1, 5]
		print('YES')
		for i in range(n // 4):
			res.append(p1 + 6 * i)
			res.append(p2 + 6 * i)
		for i in range(n // 4):
			res.append(p3 + 6 * i)
			res.append(p4 + 6 * i)
		print(*res)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print('NO')
		continue
	lista = [i * 2 for i in range(1, n // 2 + 1)]
	soma = sum(lista)
	soma2 = 0
	for i in range(1, len(lista) * 2 - 1, 2):
		soma2 += i
		lista.append(i)
	if (soma - soma2) % 2 == 1:
		lista.append(soma - soma2)
		soma2 += soma - soma2
		print('YES')
		print(*lista)
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	odd = [1]
	even = [2]
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		h = int(n / 2)
		for i in range(1, h):
			even.append(even[i - 1] + 2)
			if i != h - 1:
				odd.append(odd[i - 1] + 2)
		even_sum = n / 4 * (4 + (n / 2 - 1) * 2)
		odd_sum = len(odd) / 2 * (2 + (len(odd) - 1) * 2)
		odd.append(int(even_sum - odd_sum))
		even += odd
		for i in even:
			print(i, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		a = []
		b = []
		n //= 4
		k = 0
		s = 2
		while k < n:
			k += 1
			a.append(s)
			a.append(s + 4)
			b.append(s + 1)
			b.append(s + 3)
			s += 6
		print('YES')
		print(*a + b)


t = int(input())
a = [2 * i for i in range(1, 200000)]
b = [2 * i + 1 for i in range(200000)]
for i in range(t):
	p = int(input())
	if p / 2 % 2 == 1:
		print('NO')
	else:
		ansl = a[:int(p / 2)]
		ansr = b[:int(p / 2)]
		ansr[-1] += int(p / 2)
		print('YES')
		print(' '.join(map(str, ansl + ansr)))


t = int(input())
list1 = []
for i in range(0, t):
	n = int(input())
	x = ''
	if n % 4 == 0:
		list1.append('YES')
		a = int(n / 2)
		for i in range(1, a + 1):
			x += '{} '.format(2 * i)
		for i in range(1, a):
			x += '{} '.format(2 * i - 1)
		x += '{}'.format(3 * a - 1)
		list1.append(x)
	else:
		list1.append('NO')
for r in list1:
	print(r)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	imos = [0] * (2 * k + 2)
	for i in range(n // 2):
		s = a[i]
		t = a[n - 1 - i]
		(s, t) = (min(s, t), max(s, t))
		l = s + 1
		m = s + t
		r = t + k
		imos[l] += 1
		imos[m] -= 1
		imos[m + 1] += 1
		imos[r + 1] -= 1
		imos[1] += 2
		imos[l] -= 2
		imos[r + 1] += 2
		imos[2 * k + 1] -= 2
	for i in range(1, 2 * k + 2):
		imos[i] += imos[i - 1]
	ans = 10 ** 18
	for i in range(1, 2 * k + 1):
		ans = min(ans, imos[i])
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = [i for i in range(1, n + 1) if i % 2 == 0]
		l1 = [i for i in range(1, n + 1) if i % 2 != 0]
		l1[len(l1) - 1] = l1[len(l1) - 1] + sum(l) - sum(l1)
		l3 = l + l1
		for i in l3:
			print(i, end=' ')


from sys import stdin
import math
n = int(stdin.readline())
for _ in range(n):
	cur = int(stdin.readline())
	if cur / 2 % 2 == 0:
		even_sum = 0
		cur_even = 2
		print('YES')
		for i in range(cur // 2):
			even_sum += cur_even
			print(cur_even, end=' ')
			cur_even += 2
		odd_sum = 0
		cur_odd = 1
		for i in range(cur // 2 - 1):
			odd_sum += cur_odd
			print(cur_odd, end=' ')
			cur_odd += 2
		print(even_sum - odd_sum)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		a = []
		nums = 10
		num = 5
		for w in range(int(n / 2)):
			a.append(nums)
			nums += 10
		for w in range(int(n / 2)):
			a.append(num)
			num += 10
		a[-1] += int(5 * (n / 2))
		for j in a:
			print(j, end=' ')
	else:
		print('NO')


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())
for case in range(itg()):
	(n, k) = mpint()
	arr = tuple(mpint())
	cnt = [0] * (2 * k + 7)
	cnt[0] = n
	for i in range(n >> 1):
		(a, b) = (arr[i], arr[-i - 1])
		mn = min(a, b) + 1
		mx = max(a, b) + k
		cnt[mn] -= 1
		cnt[a + b] -= 1
		cnt[a + b + 1] += 1
		cnt[mx + 1] += 1
	ans = n
	for i in range(1, len(cnt)):
		cnt[i] += cnt[i - 1]
		ans = min(ans, cnt[i])
	print(ans)


import math
m = int(input())
while m:
	n = int(input())
	if n % 4 == 0:
		res = n // 2 * (n // 2 + 1)
		res1 = math.pow(n // 2, 2)
		l1 = [i for i in range(1, n + 1) if i % 2 == 0]
		l2 = [i for i in range(1, n + 1) if i % 2 == 1]
		l2[-1] = int(l2[-1] + (res - res1))
		print('YES')
		print(*l1, *l2)
	else:
		print('NO')
	m = m - 1


t = int(input())
while t:
	n = int(input())
	c = 0
	arl = []
	while c < n // 2:
		arl.append((c + 1) * 2)
		c += 1
	arr = []
	for ele in arl:
		arr.append(ele - 1)
	arr[-1] = n // 2 - 1 + arl[-1]
	ar = arl + arr
	if arr[-1] % 2:
		print('YES')
		for ele in ar:
			print(ele, end=' ')
	else:
		print('NO')
	t -= 1


import sys, os.path
sys.setrecursionlimit(10 ** 5)

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 evensum(n):
	n = int(n / 2)
	return n * (n + 1)

def oddsum(n):
	n = int(n / 2) - 1
	return n * n

def solve():
	n = II()
	if n / 2 % 2 == 0:
		print('YES')
		for _ in range(1, int(n / 2) + 1):
			print(2 * _, end=' ')
		for _ in range(1, int(n / 2)):
			print(2 * _ - 1, end=' ')
		print(evensum(n) - oddsum(n), end=' ')
		print()
		return False
	else:
		flag = False
	if flag == False:
		print('NO')
for _ in range(II()):
	solve()


def solve(n):
	if n // 2 % 2 == 1:
		print('NO')
		return
	print('YES')
	ans = list(range(4, 4 + 2 * (n // 2), 2)) + list(range(3, 3 + 2 * (n // 2 - 1), 2))
	ans.append(3 + 2 * (n // 2 - 1) + n // 2)
	print(' '.join((str(i) for i in ans)))
for _ in range(int(input())):
	solve(int(input()))


t = int(input())
while t != 0:
	lst = []
	n = int(input())
	k = 1
	count = 0
	if int(int(n / 2) % 2) == 0:
		while len(lst) != int(n / 2):
			if count == 2:
				count = 0
				k += 1
			else:
				lst.append(2 * k)
				k += 1
				count += 1
		count = 0
		k = 1
		while len(lst) != n:
			if count == 1:
				count += 1
			elif count == 2:
				count = 0
				lst.append(2 * k - 1)
			else:
				lst.append(2 * k - 1)
				count += 1
			k += 1
		print('YES')
		for item in lst:
			print(item, end=' ')
		print('')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	x = int(input())
	if x <= 3:
		print('NO')
		continue
	elif x % 4 == 0:
		print('YES')
		sum = 0
		gol = 0
		c = 2
		for i in range(x // 2):
			sum += c
			print(c, end=' ')
			c += 2
		c = 1
		for i in range(x // 2 - 1):
			gol += c
			print(c, end=' ')
			c += 2
		print(sum - gol)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	left = [x for x in range(2, n + 1, 2)]
	leftSum = sum(left)
	right = [x for x in range(1, n, 2)]
	ele = leftSum - sum(right[:-1])
	if ele & 1:
		print('YES')
		right[-1] = ele
		for item in left:
			print(item, end=' ')
		for item in right:
			print(item, end=' ')
		print()
	else:
		print('NO')


t = int(input())
d = [] * t
for i in range(t):
	d.append([] * t)
for it in range(t):
	y = int(input())
	ln = y // 2
	if ln % 2 != 0:
		continue
	l = [0] * ln
	r = [0] * ln
	k = 2
	for i in range(ln):
		l[i] = k
		k += 2
	k = 1
	for i in range(ln):
		r[i] = k
		k += 2
	(sl, sr) = (sum(l), sum(r))
	if sr > sl:
		l[ln - 1] += sr - sl
	if sl > sr:
		r[-1] += sl - sr
	d[it] = l + r
for el in d:
	if el:
		print('YES')
		print(*el)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	o = 1
	e = 2
	res = []
	if n % 4 == 0:
		print('YES')
		h = n // 2
		so = 0
		se = 0
		for i in range(n):
			if i < h:
				print(e, end=' ')
				se += e
				e += 2
			else:
				so += o
				if so == se - h:
					print(h + o)
					break
				print(o, end=' ')
				o += 2
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	k = 2
	evensum = 0
	for i in range(n // 2):
		a.append(k)
		evensum += k
		k += 2
	odd = 1
	oddsum = 0
	for i in range(n // 2 - 1):
		a.append(odd)
		oddsum += odd
		odd += 2
	if (evensum - oddsum) % 2 == 1:
		a.append(evensum - oddsum)
		print('YES')
		for j in a:
			print(j, end=' ')
		print('')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [0] * (2 * k + 2)
	for i in range(n // 2):
		x = a[i] + a[n - i - 1]
		(p, q) = (min(a[i], a[n - i - 1]), max(a[i], a[n - i - 1]))
		b[p + 1] -= 1
		b[q + k + 1] += 1
	for i in range(2, 2 * k + 1):
		b[i] += b[i - 1]
	for i in range(n // 2):
		x = a[i] + a[n - i - 1]
		b[x] -= 1
	ans = min(b)
	print(ans + n)


t = int(input())
for test in range(t):
	n = int(input())
	d = n // 2
	if d % 2 == 1:
		print('NO')
		continue
	arr = []
	for i in range(1, d + 1):
		arr.append(2 * i)
	s = sum(arr)
	for i in range(d - 1):
		arr.append(2 * i + 1)
		s -= 2 * i + 1
	print('YES')
	arr.append(s)
	print(*arr)


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1 or n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	arr = []
	i = 1
	while i <= n / 2:
		arr.append(i * 2)
		i += 1
	sumarr = sum(arr) // (n // 2)
	arrleft = []
	cur = 1
	if sumarr % 2 == 0:
		cur = sumarr - 1 - n // 2
	else:
		cur = sumarr - n // 2
	for i in range(0, n // 4):
		arrleft.append(cur)
		cur += 2
	cur += 2
	for i in range(0, n // 4):
		arrleft.append(cur)
		cur += 2
	print(*arr + arrleft, sep=' ')


t = int(input())
while t > 0:
	n = int(input())
	n1 = n
	n = n // 2
	s1 = n * n
	s2 = n * (n + 1)
	k = s2 - s1
	l = []
	l1 = []
	if k % 2 != 0:
		print('NO')
	else:
		for i in range(n1, 0, -1):
			if i % 2 != 0:
				if k > 0:
					l.append(i + 2)
					k -= 2
				else:
					l.append(i)
			else:
				l1.append(i)
		print('YES')
		for i in l1:
			print(i, end=' ')
		for i in l:
			print(i, end=' ')
		print()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		l = []
		i = 2
		s = 0
		for _ in range(n // 2):
			s = s + i
			l.append(i)
			i = i + 2
		i = 1
		s1 = 0
		for _ in range(n // 2 - 1):
			s1 = s1 + i
			l.append(i)
			i = i + 2
		l.append(s - s1)
		print(*l)


t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	if x // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		sum1 = 0
		for i in range(1, x // 2 + 1):
			sum1 += 2 * i
			print(2 * i, end=' ')
		sum2 = 0
		for i in range(1, x // 2):
			sum2 += 2 * i - 1
			print(2 * i - 1, end=' ')
		print(abs(sum1 - sum2))


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0 or n < 3:
		print('NO')
	else:
		l = []
		l1 = []
		k = 0
		i = 2
		s = 0
		s1 = 0
		while k < n / 2:
			l.append(i)
			s += i
			l1.append(i - 1)
			s1 += i - 1
			i += 2
			k += 1
		l1.pop()
		s1 -= i - 3
		while s1 != s:
			l1.append(i - 3)
			s1 += i - 3
			if s1 == s:
				print('YES')
				p = l + l1
				print(*p)
				s1 = s
			elif s1 < s:
				l1.pop()
				s1 -= i - 3
				i += 2


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		m = n // 2
		sumeven = m * (m + 1)
		i = 1
		sumodd = 1
		l = [1]
		l1 = []
		for k in range(2, n + 1, 2):
			l1.append(k)
		while sumeven != sumodd:
			i = i + 2
			sumodd = sumodd + i
			if sumodd < sumeven:
				l.append(i)
			elif sumodd > sumeven:
				l.pop()
				sumodd -= i - 2
				l.append(i)
			else:
				l.append(i)
				break
		l3 = l1 + l
		print(*l3, sep=' ')


testcase = int(input())
Nums = [int(input()) for _ in range(testcase)]
for n in Nums:
	if n // 2 % 2 == 1:
		print('No')
		continue
	a = [0] * n
	i = 1
	for i in range(n // 2):
		a[i + n // 2] = 1 + 2 * (i + 1)
	sum = (n // 2) ** 2 + n
	temp = sum
	for i in range(n // 2):
		if i == n // 2 - 1:
			a[i] = temp
			break
		a[i] = 2 + 2 * i
		temp = temp - a[i]
	print('Yes')
	s = ' '.join([str(n) for n in a])
	print(s)


num_cases = int(input())
for _ in range(num_cases):
	num = int(input())
	if num % 4 != 0:
		print('NO')
	else:
		print('YES')
		sum = 0
		x = 2
		while x <= num:
			print(x, end=' ')
			sum += x
			x += 2
		x = 1
		count = 0
		while count < num / 2 - 1:
			print(x, end=' ')
			sum -= x
			x += 2
			count += 1
		print(sum)


for i in range(int(input())):
	number = int(input())
	if number % 4 != 0:
		print('NO')
	else:
		print('YES')
		for x in range(2, number + 1, 2):
			print(x, end=' ')
		for y in range(1, number - 2, 2):
			print(y, end=' ')
		print(number + number // 2 - 1)


T = int(input())

def solve(N):
	out_li = [0 for x in range(N)]
	num = 2
	for i in range(N // 2):
		out_li[i] = num
		num += 2
	check_odd = out_li[N // 2 - 1] + (N // 2 - 1)
	if check_odd % 2 == 0:
		return False
	num = 1
	for i in range(N // 2, N - 1):
		out_li[i] = num
		num += 2
	out_li[-1] = check_odd
	return out_li
ans = []
for _ in range(T):
	N = int(input())
	if solve(N) == False:
		ans.append('NO')
	else:
		ans.append('YES')
		ans.append(solve(N))
for item in ans:
	if type(item) == str:
		print(item)
	else:
		for num in item:
			print(num, end=' ')
		print()


import sys
input = sys.stdin.buffer.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		re = n // 2
		l1 = [2 * i for i in range(1, re + 1)]
		l = [2 * i - 1 for i in range(1, re)]
		lasn = 3 * re - 1
		l.append(lasn)
		print('yes')
		print(*l1, *l)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = []
	if n // 2 & 1 or n & 1:
		print('NO')
		continue
	x = 2
	res = []
	print('YES')
	for i in range(n // 2):
		res.append(x)
		x += 4
	x = 2
	for i in range(n // 2):
		if i % 2 == 0:
			res.append(x - 1)
		else:
			res.append(x + 1)
		x += 4
	print(*res)


from math import ceil, sqrt, floor, sqrt
import collections
from typing import List
from fractions import gcd
from collections import deque
from collections import defaultdict, Counter
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1 or n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		n2 = n // 2
		sumv = 0
		for i in range(1, n2 + 1):
			print(2 * i, end=' ')
			sumv += 2 * i
		for i in range(1, n2):
			print(2 * i - 1, end=' ')
			sumv -= 2 * i - 1
		print(sumv)


def f(x):
	t = 0
	if x % 4 != 0:
		print('NO')
		return
	elif x % 4 == 0:
		a = []
		for i in range(1, x // 2 + 1):
			a.append(2 * i)
		for i in range(0, x // 2 + 1):
			a.append(2 * i + 1)
		a.remove(x // 2 + 1)
		print('YES')
		return a
for _ in range(int(input())):
	n = int(input())
	arr = f(n)
	if arr:
		for i in arr:
			print(i, end=' ')
		print()


from collections import defaultdict
for _ in range(int(input())):
	N = int(input())
	if N // 2 % 2 != 0:
		print('NO')
		continue
	print('YES')
	Even = []
	Odd = []
	for i in range(1, N + 1):
		if i % 2 == 0:
			Even.append(i)
		elif i != N - 1:
			Odd.append(i)
	Odd.append(sum(Even) - sum(Odd))
	for i in Even:
		print(i, end=' ')
	for i in Odd:
		print(i, end=' ')
	print()


def array(n):
	x = n // 2
	if x % 2 != 0:
		print('NO')
	else:
		l = []
		r = []
		suml = 0
		sumr = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				l.append(i)
				suml += i
			else:
				r.append(i)
				sumr += i
		r[-1] = suml - sumr + r[-1]
		print('YES')
		p = l + r
		print(*p)
t = int(input())
for i in range(t):
	n = int(input())
	array(n)


for _ in range(int(input())):
	n = int(input()) // 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		li = list(range(2, n * 2 + 1, 2))
		li2 = []
		for i in range(n):
			if i < n // 2:
				li2.append(li[i] - 1)
			else:
				li2.append(li[i] + 1)
		li += li2
		print(*li, sep=' ')


def solution(n):
	if n // 2 % 2 == 1:
		return 0
	(even, odd) = ([], [])
	(e, o) = (0, 0)
	for i in range(2, n + 1, 2):
		even.append(i)
		e += i
		odd.append(i - 1)
		o += i - 1
	odd.append(e - o + odd.pop())
	even.extend(odd)
	return even
for _ in range(int(input())):
	sol = solution(int(input()))
	if not sol:
		print('NO')
	else:
		print('YES')
		print(*sol, sep=' ')


import math
n = int(input())
for i in range(n):
	j = int(input())
	if j / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		s = 2
		while s <= j:
			print(s, end=' ')
			s += 2
		s = 1
		while s <= j + 1:
			if s != j + 1 and s != (j + 2) / 2:
				print(s, end=' ')
			elif s == j + 1:
				print(s)
			s += 2


q = int(input())
for _ in range(q):
	(n, k) = map(int, input().split())
	s = [int(i) for i in input().split()]
	cost0 = [0] * (2 * k + 1)
	cost1 = [0] * (2 * k + 1)
	for i in range(n // 2):
		cost0[s[i] + s[n - i - 1]] += 1
		cost1[min(s[i], s[n - i - 1]) + 1] += 1
		if max(s[i], s[n - i - 1]) < k:
			cost1[max(s[i], s[n - i - 1]) + k + 1] -= 1
	for i in range(3, 2 * k + 1):
		cost1[i] += cost1[i - 1]
	ans = n
	for x in range(2, 2 * k + 1):
		cost = n - cost1[x] - cost0[x]
		ans = min(ans, cost)
	print(ans)


N = int(input())
for i in range(N):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = [0] * n
		tp = 2
		for i in range(0, n // 2):
			a[i] = tp
			tp += 4
			if i % 2 == 0:
				a[i + n // 2] = a[i] + 1
			else:
				a[i + n // 2] = a[i] - 1
		print(*a, sep=' ')


T = int(input())
for i in range(T):
	n = int(input())
	a1 = []
	a2 = []
	j = 2
	while len(a1) < n / 2:
		a1.append(j)
		j = j + 2
	k = 1
	while len(a2) < n / 2:
		a2.append(k)
		k = k + 2
	if (a1[-1] + len(a1) - 1) % 2 != 0:
		a2[-1] = a1[-1] + len(a1) - 1
	if sum(a1) == sum(a2):
		print('YES')
		for ele in a1:
			print(ele, end=' ')
		for ele in a2:
			print(ele, end=' ')
		print()
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		k = []
		print('YES')
		for j in range(2, n + 1, 2):
			k.append(j)
		for j in range(1, 2 * (n // 2 - 1), 2):
			k.append(j)
		k.append(int(n * 1.5 - 1))
		print(*k)


def solve(n):
	if n % 4 != 0:
		return 'NO'
	ans = []
	e = 2
	o = 1
	half = n // 2
	for i in range(half):
		ans.append(e)
		if i % 2 == 0:
			e += 2
		else:
			e += 4
	for j in range(half):
		ans.append(o)
		if j % 2 == 0:
			o += 4
		else:
			o += 2
	return ('YES', ans)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		ans = solve(n)
		if ans == 'NO':
			print(ans)
		else:
			print(ans[0])
			l = ans[1]
			for k in l:
				print(k, end=' ')
			print()
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		(e, o) = (2, 1)
		(sum_e, sum_o) = (0, 0)
		results = []
		for j in range(n):
			if j < n // 2:
				results.append(e)
				sum_e += e
				e += 2
			elif j != n - 1:
				results.append(o)
				sum_o += o
				o += 2
			else:
				results.append(sum_e - sum_o)
		print(*results)


T = int(input())
for times in range(T):
	n = int(input())
	halfNumber = n // 2
	if n % 4 == 0:
		print('YES')
		dis = n // 4
		for i in range(1, halfNumber + 1):
			print(i * 2, end=' ')
		for i in range(1, halfNumber):
			print(i * 2 - 1, end=' ')
		print((halfNumber + dis) * 2 - 1)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		resodd = []
		reseven = []
		k = n // 2
		for i in range(1, k + 1):
			if i <= k // 2:
				reseven.append(2 * i)
				resodd.append(2 * i - 1)
			else:
				reseven.append(2 * i)
				resodd.append(2 * i + 1)
		res = reseven + resodd
		for i in res:
			print(i, end=' ')
		print()


def ans(l):
	if l % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, l + 1, 2):
			print(i, end=' ')
		for i in range(1, l - 1, 2):
			print(i, end=' ')
		print(int(1.5 * l - 1))
t = int(input())
for i in range(t):
	n = int(input())
	ans(n)


n = int(input())
while n > 0:
	a = int(input())
	if a % 4 == 0:
		s = ''
		print('YES')
		o = 0
		o1 = 0
		for i in range(int(a / 2)):
			print(2 + i * 2, end=' ')
			o += 2 + i * 2
		for i in range(int(a / 2) - 1):
			print(i * 2 + 1, end=' ')
			o1 += i * 2 + 1
		print(o - o1)
	else:
		print('NO')
	n -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 != 0:
		print('NO')
	else:
		k = n // 2
		if k % 2 != 0:
			print('NO')
		else:
			print('YES')
			l = []
			y = []
			for i in range(1, k + 1):
				l.append(4 * i)
				if i % 2 != 0:
					y.append(l[i - 1] - 1)
				else:
					y.append(l[i - 1] + 1)
			print(*l, *y)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import time, random
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 main():
	t = I()
	na = [I() for _ in range(t)]
	rr = []
	for n in na:
		if n % 4 > 0:
			rr.append('NO')
			continue
		rr.append('YES')
		a = list(range(2, n + 1, 2))
		b = list(range(1, n - 2, 2))
		c = [n + len(b)]
		rr.append(JA(a + b + c, ' '))
	return JA(rr, '\n')
print(main())


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))

def pr(x):
	n1 = x // 2
	arr2 = []
	arr3 = []
	s = 2
	s1 = 1
	for k in range(n1):
		if k != n1 - 1:
			arr2.append(s)
			arr3.append(s1)
		else:
			arr2.append(s)
			t = sum(arr2) - sum(arr3)
			arr3.append(t)
		s += 2
		s1 += 2
	arr2.extend(arr3)
	return arr2
for j in range(n):
	if arr[j] / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		temp = pr(arr[j])
		for it in temp:
			print(it)


def f(number):
	answer_list = []
	sum = 0
	x = 2
	for i in range(0, number // 2):
		answer_list.append(x)
		sum += x
		x += 2
	y = 1
	sum_2 = 0
	for i in range(0, number // 2):
		if i == number // 2 - 1:
			z = sum - sum_2
			answer_list.append(z)
		else:
			answer_list.append(y)
			sum_2 += y
			y += 2
	answer_list = list(map(str, answer_list))
	answer_string = ' '.join(answer_list)
	return answer_string
first_number = int(input())
list_of_answer = []
for i in range(0, first_number):
	number = int(input())
	taqsim_b_2 = number / 2
	if taqsim_b_2 % 2 != 0:
		list_of_answer.append('NO')
	else:
		list_of_answer.append('YES')
		list_of_answer.append(f(number))
for i in list_of_answer:
	print(i)


import sys
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		s = '11'
		while n % int(s, 2) != 0:
			s += '1'
		ans += str(n // int(s, 2)) + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		if not n // 2 % 2:
			ans += 'YES\n'
			arr = [[], []]
			for i in range(1, n + 2):
				if i != (n + 2) // 2:
					arr[i % 2].append(str(i))
			ans += ' '.join(arr[0] + arr[1]) + '\n'
		else:
			ans += 'NO\n'
	print(ans)
b()


for i in range(int(input())):
	n = int(input()) // 2
	if n % 2 == 0:
		print('YES')
		evens = list(range(2, 1 + 2 * n, 2))
		odds = list(range(1, 2 * (n + 1), 2))
		odds.remove(sum(odds) - sum(evens))
		ans = evens + odds
		for i in ans:
			print(i, end=' ')
	else:
		print('NO')


tests = int(input())
values = [0] * tests
for i in range(tests):
	values[i] = int(input())
for i in range(tests):
	if values[i] // 2 % 2 == 1:
		print('NO')
		continue
	list_1 = [0] * (values[i] // 2)
	list_2 = [0] * (values[i] // 2)
	zap1 = 4
	zap2 = 1
	sum1 = 0
	sum2 = 0
	for k in range(len(list_1)):
		list_1[k] = zap1
		sum1 += zap1
		zap1 += 2
	for k in range(len(list_2) - 1):
		list_2[k] = zap2
		sum2 += zap2
		zap2 += 2
	list_2[len(list_2) - 1] = sum1 - sum2
	print('YES')
	print(*list_1, *list_2)


n = int(input())
for i in range(n):
	x = int(input())
	half = x // 2
	if half % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(half):
			print(2 * (i + 1))
		for i in range(half - 1):
			print(2 * (i + 1) - 1)
		print(2 * (i + 2) - 1 + half)


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

def solve(N):
	if N % 2 == 1:
		return 'NO'
	if N % 4 != 0:
		return 'NO'
	front = []
	back = []
	BIG = 10 ** 8
	for i in range(1, N + 1, 4):
		front.append(i + 1)
		front.append(BIG - i - 1)
		back.append(i)
		back.append(BIG - i)
	return 'YES\n' + ' '.join(map(str, front + back))
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())
for i in range(t):
	n = int(input())
	arr = []
	if int(n / 2) % 2 == 0:
		k = 2
		sum = 0
		for j in range(int(n / 2)):
			arr.append(k)
			sum += k
			k += 2
		k = 1
		sum2 = 0
		for j in range(int(n / 2) - 1):
			arr.append(k)
			sum2 += k
			k += 2
		arr.append(sum - sum2)
		print('YES')
		print(*arr)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	(b, c) = ([0] * (2 * k + 1), [0] * (2 * k + 1))
	i = 0
	d = []
	while i < n // 2:
		p = a[i] + a[n - 1 - i]
		b[p] += 1
		q = min(a[i], a[n - 1 - i]) + 1
		r = max(a[i], a[n - 1 - i]) + k
		if r == 2 * k:
			c[q] += 1
		else:
			c[q] += 1
			c[r + 1] -= 1
		i += 1
	p = 2 * k + 1
	for i in range(1, p):
		c[i] = c[i - 1] + c[i]
	for i in range(2, p):
		q = b[i]
		r = c[i]
		l = r - q + (n // 2 - r) * 2
		d.append(l)
	print(min(d))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = [0] * n
		k = 2
		for i in range(0, int(n / 2)):
			l[i] = k
			k += 2
		fh = [2]
		sh = [1]
		lf = 2
		ls = 1
		sf = 2
		ss = 1
		for i in range(1, int(n / 2)):
			if sf > ss:
				fh += [lf + 2]
				sf += lf + 2
				lf += 2
				sh += [ls + 4]
				ss += ls + 4
				ls += 4
			else:
				sh += [ls + 2]
				ss += ls + 2
				ls += 2
				fh += [lf + 4]
				sf += lf + 4
				lf += 4
		l = fh + sh
		print('YES')
		for i in range(len(l)):
			print(l[i], end=' ')
		print()


def solution(n):
	if n % 4 != 0:
		return False
	A = []
	B = []
	for i in range(n // 2 - 1):
		A.append(2 + 2 * i)
		B.append(1 + 2 * i)
	A.append(2 * (n // 2))
	B.append(sum(A) - sum(B))
	return A + B
n = int(input())
for t in range(n):
	a = solution(int(input()))
	if not a:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, a)))


for _ in range(int(input())):
	n = int(input())
	a = []
	x = n // 2
	y = x // 2
	if x % 2 != 0:
		print('NO')
	else:
		for i in range(x):
			d = 2 * (i + 1)
			a.append(d)
			w = len(a) // 2
			r = len(a)
		for i in range(len(a) // 2):
			d = a[i] - 1
			a.append(d)
		for i in range(w, r):
			g = a[i] + 1
			a.append(g)
		print('YES')
		for i in a:
			print(i, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	p = n // 2
	x = []
	i = 0
	d = 2
	while i < n / 2:
		x.append(d)
		d += 2
		i += 1
	f = sum(x)
	j = 0
	h = 1
	while j < n / 2 - 1:
		x.append(h)
		h += 2
		j += 1
	k = f - sum(x[p:])
	if k % 2 == 0:
		print('NO')
	else:
		print('yes')
		x.append(k)
		print(*x)


import math

def BuubleSort(a):
	n = a // 2
	stl = (n - 1) ** 2
	soe = (n + 1) * n
	left = soe - stl
	le = [i for i in range(2, 2 * n + 1, 2)]
	lo = [i for i in range(1, 2 * n - 1, 2)]
	nl = []
	nl = le + lo
	nl.append(left)
	return nl

def main():
	n = int(input())
	for _ in range(n):
		a = int(input())
		if a // 2 % 2 == 0:
			ans = BuubleSort(a)
			print('YES')
			print(*ans)
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	s = n // 2
	if s % 2 != 0:
		print('NO')
	else:
		sm = s * (s + 1)
		print('YES')
		l = []
		so = 0
		m = 1
		for i in range(1, s + 1):
			l.append(2 * i)
		for i in range(s):
			if i == s - 1:
				l.append(sm - so)
			else:
				l.append(m)
				so += m
				m += 2
		print(*l)


t = int(input())
for u in range(t):
	n = int(input())
	res1 = ''
	res2 = ''
	if n // 2 % 2 == 0:
		for i in range(n - 1):
			if i % 2 == 0:
				res1 += str(i + 2) + ' '
			else:
				res2 += str(i) + ' '
		print('YES')
		res2 += str(n + n // 2 - 1)
		print(res1 + res2)
	else:
		print('NO')


numcases = int(input())
n = 0

def solve(n):
	if int(n / 2 % 2) == 1:
		print('NO')
		return
	a = []
	b = []
	for i in range(int(n / 2)):
		a.append(i * 2 + 2)
	for i in range(int(n / 2)):
		if i == int(n / 2) - 1:
			b.append(sum(a) - sum(b))
		else:
			b.append(a[i] - 1)
	print('YES')
	print(*a + b)
	return
for i in range(numcases):
	n = int(input())
	solve(n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	pre = [0 for i in range(2 * k + 2)]
	arr = list(map(int, input().split()))
	zero = {}
	cnt1 = cnt2 = cnt0 = cnt = 0
	mini = float('inf')
	for i in range(n // 2):
		try:
			zero[arr[i] + arr[n - i - 1]] += 1
		except:
			zero[arr[i] + arr[n - i - 1]] = 1
		l = arr[i]
		r = arr[n - i - 1]
		(l, r) = sorted([l, r])
		pre[l + 1] += 1
		pre[r + k + 1] -= 1
	for i in range(1, len(pre)):
		pre[i] += pre[i - 1]
	for i in range(2, 2 * k + 1):
		cnt0 = zero.get(i, 0)
		cnt1 = pre[i] - cnt0
		cnt2 = n // 2 - cnt1 - cnt0
		cnt = 2 * cnt2 + cnt1
		mini = min(cnt, mini)
	print(mini)


for i in range(int(input())):
	num = int(input())
	if num // 2 % 2:
		print('NO')
		continue
	else:
		print('YES')
		print(' '.join((str(2 * x) for x in range(1, num // 2 + 1))) + ' ' + ' '.join((str(2 * y + 1) for y in range(num // 2 - 1))) + ' ' + str(num * (num + 2) // 4 - (num - 2) ** 2 // 4))


t = int(input())
while t > 0:
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		vals = n // 2
		print('YES')
		p1 = 2
		p2 = 4
		for i in range(0, n // 4):
			print(p1, p2, end=' ')
			p1 += 6
			p2 += 6
		p1 = 1
		p2 = 5
		for i in range(0, n // 4):
			print(p1, p2, end=' ')
			p1 += 6
			p2 += 6
		print()
	t -= 1


A = [0 for x in range(400005)]
t = int(input())

def mymin(a, b):
	if a < b:
		return a
	else:
		return b

def mymax(a, b):
	if a > b:
		return a
	else:
		return b
for tests in range(t):
	[n, k] = input().split()
	n = int(n)
	k = int(k)
	B = input().split()
	for i in range(2, 2 * k + 1):
		A[i] = 0
	n2 = int(n / 2)
	for i in range(n2):
		B[i] = int(B[i])
		B[n - 1 - i] = int(B[n - 1 - i])
		mi = mymin(B[i], B[n - 1 - i])
		ma = mymax(B[i], B[n - 1 - i])
		A[2] += 2
		A[mi + 1] -= 1
		A[mi + ma] -= 1
		if mi + ma + 1 <= 2 * k:
			A[mi + ma + 1] += 1
		if ma + k + 1 <= 2 * k:
			A[ma + k + 1] += 1
	ans = n
	for i in range(2, 2 * k + 1):
		A[i] += A[i - 1]
		if A[i] < ans:
			ans = A[i]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	lst = []
	if x % 2 == 0 and x >= 2:
		print('YES')
		for i in range(1, 2 * x + 1):
			if i % 2 == 0:
				lst.append(i)
		k = sum(lst)
		for i in range(1, 2 * x - 1):
			if i % 2 != 0:
				lst.append(i)
		p = sum(lst)
		z = p - k
		p = k - z
		lst.append(p)
		print(*lst)
	else:
		print('NO')


for x in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('No')
	else:
		print('Yes')
		l = []
		l.extend(list(range(2, n + 1, 2)))
		ab = sum(l)
		a = 1
		for y in range(n // 2 - 1):
			l.append(a)
			a += 2
		l.append(2 * ab - sum(l))
		print(' '.join((str(x) for x in l)))


t = int(input())
for i1 in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	sums = [0] * (2 * k + 2)
	arr = [0] * (2 * k + 2)
	pref = [0] * (2 * k + 2)
	for i2 in range(0, n // 2):
		temp = a[i2] + a[n - i2 - 1]
		sums[temp] += 1
		arr[min(a[i2], a[n - i2 - 1]) + 1] += 1
		arr[max(a[i2], a[n - i2 - 1]) + k + 1] -= 1
	temp = 0
	for i2 in range(len(arr)):
		temp += arr[i2]
		pref[i2] = temp
	result = 90000000000.0
	for i2 in range(len(arr)):
		temp = pref[i2] - sums[i2] + 2 * (n // 2 - pref[i2])
		result = min(temp, result)
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	temp = n // 2
	if temp % 2 != 0:
		print('NO')
		continue
	l = []
	r = []
	temp = 0
	temp1 = 1
	for i in range(n // 2):
		temp += 2
		l.append(temp)
		r.append(temp1)
		temp1 += 2
	r.remove(r[len(r) - 1])
	d = sum(l) - sum(r)
	r.append(d)
	result = l + r
	print('YES')
	for i in result:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('No')
	else:
		print('YES')
		k = n // 2
		e = []
		o = []
		for i in range(1, k + 1):
			e.append(2 * i)
		s = sum(e)
		for i in range(k - 1):
			o.append(e[i] - 1)
		s1 = sum(o)
		o.append(s - s1)
		for i in e:
			print(i, end=' ')
		print(*o)


T = int(input())
for tc in range(1, 1 + T):
	n = int(input())
	half = n // 2
	if half % 2:
		print('NO')
	else:
		print('YES')
		first = list(range(2, 2 * half + 1, 2))
		second = list(range(1, 2 * (half - 1) + 1, 2))
		second.append(half * 2 + half - 1)
		for i in first:
			print(i, end=' ')
		for i in second:
			print(i, end=' ')
		print()


for test in range(int(input())):
	n = int(input())
	print('YES\n', *[*(num for num in range(2, n + 2, 2))] + [*(num for num in range(1, n - 1, 2))] + [3 * (n // 2) - 1]) if n % 4 == 0 else print('NO')


def fun(n):
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		x = n // 2
		l = []
		for i in range(x):
			l.append(2 * (i + 1))
		for i in range(x - 1):
			p = 2 * i + 1
			l.append(p)
		for i in range(x // 2 + 1):
			p += 2
		l.append(p)
		print(*l)
t = int(input())
for _ in range(t):
	n = int(input())
	fun(n)


L_bool = []
L_znach = []
k = 0
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		L_bool.append('NO')
	else:
		L_bool.append('YES')
		L_znach.append([])
		for j in range(2, n + 1, 2):
			L_znach[k].append(j)
		for j in range(1, n, 2):
			L_znach[k].append(j)
		L_znach[k][n - 1] += n // 2
		k += 1
for i in range(t):
	if L_bool[i] == 'NO':
		print(L_bool[i])
	else:
		print(L_bool[i])
		L1 = L_znach.pop(0)
		for x in L1:
			print(x, end=' ')
		print()


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	print('YES')
	total = 0
	ans = []
	for i in range(2, n + 1, 2):
		ans.append(i)
		total += i
	for i in range(1, n - 1, 2):
		ans.append(i)
		total -= i
	ans.append(total)
	print(*ans)
for _ in range(int(input())):
	main()


def solve():
	n = int(input())
	if n // 2 % 2 == 0:
		ans1 = []
		ans2 = []
		print('YES')
		for i in range(2, n + 2, 2):
			ans1.append(i)
		for i in range(1, n - 1, 2):
			ans2.append(i)
		ans2.append(sum(ans1) - sum(ans2))
		for i in range(n // 2):
			print(ans1[i], end=' ')
		for i in range(n // 2):
			print(ans2[i], end=' ')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


n = int(input())
for i in range(n):
	number = int(input())
	if number % 4:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(2, number + 1, 2):
			print(i, end=' ')
		for i in range(1, number - 1, 2):
			print(i, end=' ')
		print(number - 1 + number // 2)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		ans = []
		print('YES')
		for i in range(int(n / 2)):
			ans.append(2 * (i + 1))
		for i in range(int(n / 2) - 1):
			ans.append(2 * i + 1)
		ans.append(sum(ans[:int(n / 2)]) - sum(ans[int(n / 2):n - 1]))
		print(*ans, sep=' ')


t = int(input())

def fun(n):
	k = n / 2
	if k % 2 == 1:
		print('NO')
	else:
		a = []
		o = 2
		for i in range(int(k)):
			a.append(o)
			o += 2
		cur = 1
		su = a[0] + a[-1]
		for i in range(int(k / 2)):
			a.append(cur)
			a.append(su - cur)
			cur += 2
		print('YES')
		print(*a, sep=' ')
while t:
	t -= 1
	n = int(input())
	fun(n)


t = int(input())
for i in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		even = sum_even = 0
		for j in range(n // 2):
			even += 2
			sum_even += even
			print(even, end=' ')
		odd = -1
		sum_odd = 0
		for i in range(n // 2 - 1):
			odd += 2
			sum_odd += odd
			print(odd, end=' ')
		print(sum_even - sum_odd)


for i in range(int(input())):
	n = int(input())
	ans = []
	if n // 2 % 2 == 1:
		print('NO')
		continue
	te = 2
	for j in range(n // 2):
		ans.append(te)
		te += 2
	l1 = ans[:len(ans) // 2]
	l2 = ans[len(ans) // 2:]
	for j in l1:
		ans.append(j - 1)
	for j in l2:
		ans.append(j + 1)
	print('YES')
	for j in range(len(ans)):
		print(ans[j], end=' ')
	print()


T = int(input())
for _ in range(0, T):
	cnt = 1
	eve = []
	e = 2
	odd = []
	n = int(input())
	j = n // 2
	if j % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(0, n // 2):
			eve.append(e)
			e = e + 2
		for i in range(0, len(eve) // 2):
			odd.append(eve[i] - 1)
		for i in range(len(eve) // 2, len(eve)):
			odd.append(eve[i] + 1)
		for i in range(0, len(eve)):
			print(eve[i], end=' ')
		for i in range(0, len(odd)):
			print(odd[i], end=' ')
		print()


t = int(input())
for k in range(t):
	n = int(input())
	od = []
	ev = []
	val = 0
	oval = 0
	ans = []
	if int(n / 2) % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, int(n / 2)):
			od.append(2 * i - 1)
			oval = oval + (2 * i - 1)
			ev.append(i * 2)
			val = val + 2 * i
		val = val + 2 * (i + 1)
		ev.append(2 * (i + 1))
		od.append(val - oval)
		ans = ev + od
		print(*ans)


def sol():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	a = 2
	b = 1
	a1 = []
	a2 = []
	for i in range(n // 2):
		if i == n // 2 - 1:
			a2.append(b + n // 2)
		else:
			a2.append(b)
		a1.append(a)
		a += 2
		b += 2
	print('YES')
	for i in a1 + a2:
		print(i, end=' ')
	print()
for _ in range(int(input())):
	sol()


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
		continue
	l = [None] * n
	for i in range(n // 2):
		l[n // 2 + i] = i * 2 + 1
		l[i] = (i + 1) * 2
	l[-1] += n // 2
	print('YES')
	print(*l, sep=' ')


for _ in range(int(input())):
	n = int(input())
	if n == 2 or n // 2 % 2 == 1:
		print('NO')
	else:
		sume = 0
		sumo = 0
		i = 0
		e = 2
		o = 1
		a = []
		while i < n:
			if i < n // 2:
				sume += e
				a.append(e)
				e += 2
			elif i < n - 1:
				sumo += o
				a.append(o)
				o += 2
			else:
				a.append(sume - sumo)
			i += 1
		print('YES')
		print(*a)


def main():
	t = int(input())
	while t:
		n = int(input())
		if n // 2 % 2 != 0:
			print('NO')
		else:
			arre = []
			add = 0
			temp = 0
			for i in range(n // 2):
				temp += 2
				arre.append(temp)
				add += temp
			arro = []
			addo = 0
			temp = 1
			for i in range((n - 1) // 2):
				arro.append(temp)
				addo += temp
				temp += 2
			arro.append(add - addo)
			print('YES')
			for x in arre:
				print(x, end=' ')
			for x in arro:
				print(x, end=' ')
			print()
		t -= 1
main()


for _ in range(int(input())):
	(n, k) = [int(j) for j in input().split()]
	a = [int(x) for x in input().split()]
	lst = [n] + [0] * (k * 2)
	for i in range(n // 2):
		(x, y) = sorted((a[i], a[-(i + 1)]))
		lst[x] -= 1
		lst[x + y - 1] -= 1
		lst[x + y] += 1
		lst[k + y] += 1
	for i in range(2 * k):
		lst[i + 1] += lst[i]
	print(min(lst))


def solve():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	lo = {i: 0 for i in range(2, 2 * k + 1)}

	def update_range(l, r, v):
		if l > r:
			return
		if l == 2:
			lo[r] += v
		else:
			lo[r] += v
			lo[l - 1] -= v
		return
	for i in range(n // 2):
		(a1, a2) = (A[i], A[n - i - 1])
		(m, M) = (min(a1, a2), max(a1, a2))
		update_range(2, m, 2)
		update_range(m + 1, m + M - 1, 1)
		update_range(m + M + 1, M + k, 1)
		update_range(M + k + 1, 2 * k, 2)
	partial = lo[2 * k]
	answer = partial
	for i in range(2 * k - 1, 1, -1):
		partial += lo[i]
		answer = min(answer, partial)
	print(answer)
t = int(input())
for i in range(t):
	solve()


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


for i in range(int(input())):
	p = int(input())
	if p // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		s1 = [i for i in range(2, p + 1, 2)]
		s2 = [i for i in range(1, p - 1, 2)]
		s2.append(sum(s1) - sum(s2))
		s = s1 + s2
		for j in range(p):
			print(s[j], end=' ')
		print()


import math
for test in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		a = 2
		sum = 0
		for i in range(n // 2):
			sum += a
			print(a, end=' ')
			a += 2
		a = 1
		sum2 = 0
		for j in range(n // 2 - 1):
			sum2 += a
			print(a, end=' ')
			a += 2
		print(sum - sum2)


t = int(input())
for x in range(t):
	n = int(input())
	if n == 2:
		print('NO')
		continue
	even_arr = [x for x in range(0, n + 1, 2)]
	odd_arr = [x for x in range(1, n - 2, 2)]
	even_arr.pop(0)
	sum_even = sum(even_arr)
	sum_odd = sum(odd_arr)
	if (sum_even - sum_odd) % 2 != 0:
		odd_arr.append(sum_even - sum_odd)
		print('YES')
		print(' '.join(list(map(str, even_arr))) + ' ' + ' '.join(list(map(str, odd_arr))))
	else:
		print('NO')


try:
	T = int(input())
	for i in range(T):
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			l = []
			print('YES')
			for i in range(2, n + 1, 2):
				l.append(i)
			for i in range(1, n, 2):
				l.append(i)
			l[-1] += n // 2
			for i in l:
				print(i, end=' ')
			print()
except:
	pass


from sys import stdout
for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	else:
		print('YES')
		c = ''
		for i in range(1, int(n // 2) + 1):
			c += str(2 * i) + ' '
		a = int(c[0])
		b = int(n)
		d = (a + b) / 2 - 1
		e = d * (d + 1)
		for i in range(1, n - 1, 2):
			c += str(i) + ' '
		c += str(int(e - (n // 2 - 1) ** 2))
		stdout.write(c)
		print('')


def solve():
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		sp = 0
		for i in range(n // 2):
			sp += (i + 1) * 2
			print((i + 1) * 2, end=' ')
		s = 0
		for i in range(n // 2):
			ii = i * 2 + 1
			if i < n // 2 - 1:
				print(ii, end=' ')
			else:
				print(sp - s)
			s += ii

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


q = int(input())
for qq in range(q):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		summ = 0
		for i in range(1, n // 2 + 1):
			summ += 2 * i
			print(i * 2, end=' ')
		summ2 = 0
		for i in range(1, n // 2 + 1):
			if i != n // 2:
				summ2 += 2 * i - 1
				print(2 * i - 1, end=' ')
			else:
				print(summ - summ2, end='')
		print()
	else:
		print('NO')


def check(n):
	sum1 = 0
	for i in range(2, n + 1, 2):
		print(i, end=' ')
		sum1 += i
	for i in range(1, n - 1, 2):
		print(i, end=' ')
		sum1 -= i
	return sum1
for _ in range(int(input())):
	n1 = int(input())
	if n1 % 4 == 0:
		print('YES')
		print(check(n1))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().rstrip().split(' ')))
	arr = list(map(int, input().rstrip().split(' ')))
	sums = {}
	rangeArr = [0] * (2 * k + 2)
	tempRangeArr = [0] * (2 * k + 2)
	for i in range(n // 2):
		s = arr[i] + arr[n - i - 1]
		sums[s] = sums[s] + 1 if s in sums else 1
		tempRangeArr[min(arr[i], arr[n - i - 1]) + 1] += 1
		tempRangeArr[max(arr[i], arr[n - i - 1]) + k + 1] += -1
	rangeArr[0] = tempRangeArr[0]
	for i in range(1, len(tempRangeArr)):
		rangeArr[i] = rangeArr[i - 1] + tempRangeArr[i]
	bestMin = 9999999
	for x in range(2, 2 * k + 1):
		x1Counts = rangeArr[x]
		x0Counts = sums[x] if x in sums else 0
		x2Counts = n // 2 - x1Counts
		minCount = x1Counts + x2Counts * 2 - x0Counts
		if minCount < bestMin:
			bestMin = minCount
	print(bestMin)


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cnt = [0] * (2 * k + 1)
	for i in range(n // 2):
		cnt[a[i] + a[n - i - 1]] += 1
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		l1 = 1 + a[i]
		l2 = 1 + a[n - i - 1]
		r1 = k + a[i]
		r2 = k + a[n - i - 1]
		pref[min(l1, l2)] += 1
		pref[max(r1, r2) + 1] -= 1
	for i in range(1, 2 * k + 2):
		pref[i] += pref[i - 1]
	ans = 10 ** 10
	for sum in range(2, 2 * k + 1):
		ta = pref[sum] - cnt[sum] + (n / 2 - pref[sum]) * 2
		ans = min(ans, ta)
	print(int(ans))


def solve(n):
	if n % 4 != 0:
		return 'NO'
	m = int(n // 2)
	ans = list(range(2, 2 * m + 1, 2)) + list(range(1, 2 * m - 1, 2)) + [2 * m - 1 + n // 2]
	return 'YES\n' + ' '.join((str(i) for i in ans))
t = int(input())
for i in range(t):
	print(solve(int(input())))


def create_even(n):
	l = []
	for i in range(n):
		l.append(2 * (i + 1))
	return l

def create_odd(n, x):
	l = []
	total = 0
	for i in range(n - 1):
		l.append(2 * i + 1)
		total += 2 * i + 1
	l.append(x - total)
	return l
T = int(input())
for _ in range(T):
	n = int(input())
	if n / 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		x = n // 2
		x = x * (x + 1)
		grand = create_even(n // 2) + create_odd(n // 2, x)
		print(' '.join((str(i) for i in grand)))


t = int(input())
lis = []
for tt in range(t):
	lis.append(int(input()))
for n in lis:
	if n // 2 % 2 == 1:
		print('NO')
		continue
	else:
		print('YES')
	answer_eve = []
	answer_odd = []
	for i in range(1, n - 1):
		if i % 2 == 0:
			answer_eve.append(i)
		else:
			answer_odd.append(i)
	answer_eve.append(n)
	answer_odd.append(sum(answer_eve) - sum(answer_odd))
	final_answer = ''
	for i in answer_eve:
		final_answer += str(i) + ' '
	for i in answer_odd:
		final_answer += str(i) + ' '
	print(final_answer)


t = int(input())
while t != 0:
	n = int(input())
	if n // 2 & 1:
		print('NO')
	else:
		print('YES')
		ans = []
		count = n // 2
		i = 2
		while count != 0:
			ans.append(i)
			i += 2
			count -= 1
		count = n // 2
		i = 1
		while count != 1:
			ans.append(i)
			i += 2
			count -= 1
		ans.append(i + n // 2)
		print(*ans, sep=' ')
		print()
	t -= 1


t = int(input())
for tc in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		sumeven = 0
		sumodd = 0
		for i in range(1, n // 2 + 1):
			sumeven += 2 * i
			arr.append(2 * i)
		for i in range(n // 2 - 1):
			sumodd += 2 * i + 1
			arr.append(2 * i + 1)
		arr.append(sumeven - sumodd)
		print(*arr)


tc = int(input())
for ii in range(tc):
	num = int(input())
	if num // 2 % 2 != 0:
		print('NO')
	else:
		even = []
		odd = []
		cumsum = 0
		for i in range(1, num // 2):
			cumsum += 1
			even.append(i * 2)
			odd.append(i * 2 - 1)
		even.append(2 + even[-1])
		odd.append(even[-1] + cumsum)
		res = even + odd
		print('YES')
		for ele in res:
			print(ele, end=' ')
		print()


t = int(input())
for each_t in range(t):
	n = int(input())
	dec = n // 2
	if dec % 2 == 1:
		print('NO')
	else:
		print('YES')
		x = 2
		even_sum = 0
		for i in range(dec):
			print(x, end=' ')
			even_sum += x
			x += 2
		y = 1
		odd_sum = 0
		for i in range(dec - 1):
			print(y, end=' ')
			odd_sum += y
			y += 2
		print(even_sum - odd_sum)


for _ in range(int(input())):
	n = int(input())
	p = n // 2
	if p % 2 != 0:
		print('NO')
	else:
		print('YES')
		L1 = []
		L2 = []
		p = 2
		for i in range(n // 2):
			L1.append(p)
			p = p + 2
		p1 = 1
		for i in range(n // 2 - 1):
			L2.append(p1)
			p1 = p1 + 2
		print(*L1 + L2 + [sum(L1) - sum(L2)])


works = 'YES'
fails = 'NO'

def valid(n):
	return n % 4 == 0

def generateArray(n):
	a = [0 for i in range(n)]
	for i in range(n // 2):
		a[i] = 2 * (i + 1)
		a[n // 2 + i] = 2 * (i + 1) - 1
	a[n - 1] = a[n // 2 - 1] + n // 2 - 1
	return a

def driver(tests):
	for test in tests:
		if not valid(test):
			print(fails)
		else:
			print(works)
			for i in generateArray(test):
				print(i, end=' ')
			print('')
t = int(input())
tests = [int(input()) for i in range(t)]
driver(tests)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l = [i for i in range(2, n + 1, 2)]
		sm = n / 4 * (n + 2)
		ll = []
		i = 1
		smm = 0
		while smm != sm and len(ll) + 1 != len(l):
			ll += [i]
			smm += i
			i += 2
		if len(ll) != len(l):
			ll += [int(sm - smm)]
		print('YES')
		print(*l, *ll)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		a = []
		sum1 = 0
		sum2 = 0
		for i in range(2, n + 1, 2):
			a.append(i)
			sum1 += i
		for i in range(1, n - 2, 2):
			a.append(i)
			sum2 += i
		a.append(sum1 - sum2)
		print(*a, sep=' ')


T = int(input())
for test in range(T):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n // 2 + 1):
		print(2 * i, end=' ')
	for i in range(1, n // 2):
		print(2 * i - 1, end=' ')
	print(2 * n // 2 - 1 + n // 2, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		l1 = [i for i in range(2, n + 1, 2)]
		l2 = [i for i in range(1, n - 1, 2)]
		p = n // 4 - 1
		l2.append(n + (2 * p + 1))
		k = l1 + l2
		print('YES')
		for j in k:
			print(j, end=' ')


t = int(input())

def Balanced(n):
	l = []
	l1 = []
	if n % 4 == 0:
		for i in range(1, int(n / 2) + 1):
			l.append(2 * i)
			l1.append(2 * i - 1)
		l1[int(n / 2) - 1] += int(n / 2)
		return (l + l1, True)
	else:
		return (l, False)
l = []
for _ in range(t):
	n = int(input())
	l.append(Balanced(n))
for _ in range(t):
	if l[_][1] == True:
		print('YES')
		for i in range(len(l[_][0]) - 1):
			print(l[_][0][i], end=' ')
		print(l[_][0][len(l[_][0]) - 1])
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	cntx = [0] * (2 * k + 1)
	for i in range(int(n / 2)):
		cntx[a[i] + a[n - i - 1]] += 1
	rangex = [0] * (2 * k + 2)
	for i in range(int(n / 2)):
		rangex[min(a[i], a[n - i - 1]) + 1] += 1
		rangex[max(a[i], a[n - i - 1]) + k + 1] -= 1
	for i in range(1, len(rangex)):
		rangex[i] += rangex[i - 1]
	mini = 1000000
	for i in range(2, 2 * k + 1):
		curr = rangex[i] - cntx[i] + 2 * (int(n / 2) - rangex[i])
		if mini > curr:
			mini = curr
	print(mini)


for _ in range(0, int(input())):
	size = int(input())
	size = size // 2
	if size % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, size + 1):
			print(2 * i, end=' ')
		for i in range(1, size):
			print(2 * i - 1, end=' ')
		print(size * (size + 1) - (size - 1) ** 2)


def construct(n: int) -> str:
	(k, odd, even) = (1, [], [])
	while k < n // 2:
		even.append(2 * k)
		odd.append(2 * k - 1)
		k = k + 1
	even.append(2 * k)
	odd.append(3 * k - 1)
	output_str = '{} {}'.format(' '.join(map(str, even)), ' '.join(map(str, odd)))
	return output_str
t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		print(construct(n))
	else:
		print('NO')


import sys
readline = sys.stdin.readline
writeline = sys.stdout.write
t = int(readline())
for _ in range(t):
	n = int(readline())
	if n / 2 % 2 == 0:
		writeline('YES\n')
		evens = [i * 2 for i in range(1, int(n / 2 + 1))]
		odds = [e - 1 for e in evens[:-1]] + [evens[-1] + int(n / 2 - 1)]
		ans = evens + odds
		for elem in ans:
			writeline(f'{elem} ')
		writeline('\n')
	else:
		writeline('NO\n')


T = int(input())
for _ in range(T):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		nums_l = []
		nums_r = []
		for i in range(n // 4):
			x = 3 + i * 6
			nums_l.append(str(x - 1))
			nums_l.append(str(x + 1))
			nums_r.append(str(x - 2))
			nums_r.append(str(x + 2))
		print('YES')
		print(' '.join(nums_l + nums_r))


for _ in range(int(input())):
	n = int(input())
	lst = []
	i = 2
	cnt = 0
	while True:
		if cnt == n // 2:
			break
		lst.append(i)
		i += 2
		cnt += 1
	smeven = sum(lst)
	cnt = 0
	i = 1
	while True:
		if cnt == n // 2 - 1:
			break
		lst.append(i)
		i += 2
		cnt += 1
	smodd = sum(lst) - smeven
	if smodd % 2:
		print('YES')
		print(*lst + [smeven - smodd])
	else:
		print('NO')


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


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	if m % 2 != 0:
		print('NO')
	else:
		print('YES')
		ans = []
		for i in range(1, m + 1):
			ans += [i * 2]
		for i in range(1, m + 1):
			ans += [i * 2 - 1]
		ans[-1] += m
		print(*ans, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		v = []
		c = 0
		s = 0
		for i in range(n // 2):
			q = (i + 1) * 2
			v.append(q)
			c += q
		for i in range(n // 2, n - 1):
			p = 2 * (i - n // 2 + 1) - 1
			v.append(p)
			s += p
		v.append(c - s)
		print('YES')
		for i in v:
			print(i, end=' ')
		print(end='\n')


t = int(input())
lista = []
lista2 = []
for i in range(t):
	evens = []
	odds = []
	x = int(input())
	if x % 4 == 2:
		lista.append('NO')
		continue
	else:
		lista.append('YES')
		evens = [int(q) for q in range(1, x + 1) if q % 2 == 0]
		for i in range(x // 2):
			if i < x // 4:
				odds.append(evens[i] - 1)
			else:
				odds.append(evens[i] + 1)
		evens.extend(odds)
		lista2.append(evens)
h = 0
for i in lista:
	print(i)
	if i == 'YES':
		print(' '.join(map(str, lista2[h])))
		h += 1


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		e = []
		o = []
		for i in range(2, 2 * n // 2 + 1, 2):
			e.append(str(i))
		for i in range(n // 2):
			if i >= n // 4:
				o.append(str(int(e[i]) + 1))
			else:
				o.append(str(int(e[i]) - 1))
		print('YES')
		print(' '.join(e), end=' ')
		print(' '.join(o))


for i in range(int(input())):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		i = 0
		j = 0
		k = n // 2
		c = []
		while j < k:
			i += 2
			c.append(i)
			j += 1
		d = sum(c)
		m = 1
		n = 0
		i = 1
		e = []
		while m < k:
			n += i
			e.append(i)
			i += 2
			m += 1
		f = d - n
		e.append(f)
		a = c + e
		a = ' '.join((str(i) for i in a))
		print(a)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
from itertools import accumulate

def solve(n, k, A):
	L = []
	for i in range(n // 2):
		L.append((min(A[i], A[n - i - 1]), max(A[i], A[n - i - 1])))
	Imos = [0] * (2 * k + 2)
	for (a, b) in L:
		if a != 1:
			Imos[2] += 2
			Imos[a + 1] -= 2
		Imos[a + 1] += 1
		Imos[a + b] -= 1
		Imos[a + b + 1] += 1
		Imos[b + k + 1] -= 1
		if b != k:
			Imos[b + k + 1] += 2
			Imos[2 * k + 1] -= 2
	Acc = list(accumulate(Imos))
	return min(Acc[2:2 * k + 1])

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		A = list(map(int, input().split()))
		ans = solve(n, k, A)
		sys.stdout.write(str(ans) + '\n')
main()


t = int(input())
arr = []
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	for j in range(2, n + 1, 2):
		arr.append(j)
	for j in range(1, n + 1, 2):
		arr.append(j)
		if len(arr) == n - 1:
			arr.append(sum(arr[:n // 2]) - sum(arr[n // 2:]))
			print('YES')
			print(*arr)
			arr = []
			break


import math
t = int(input())

def solve(n):
	if n % 4 != 0:
		return []
	(fir, sec) = ([2], [1])
	for i in range(1, n // 2):
		fir.append(fir[i - 1] + 2)
	for i in range(1, n // 2 - 1):
		sec.append(sec[i - 1] + 2)
	sec.append(sum(fir) - sum(sec))
	return fir + sec
for _ in range(t):
	n = int(input())
	res = solve(n)
	print('NO' if len(res) == 0 else '{0}\n{1}'.format('YES', ' '.join(list(map(str, res)))))


case = int(input())
for i in range(0, case):
	x = int(input())
	pivot = int(x / 2)
	if pivot % 2 == 0:
		print('YES')
		for j in range(1, pivot + 1):
			print(2 * j, end=' ')
		for j in range(1, pivot):
			print(2 * j - 1, end=' ')
		print(3 * pivot - 1, end=' ')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	a = list()
	b = 2
	if x % 2 == 1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n // 2 + 1):
		a.append(b * i)
	for i in range(x // 2):
		a.append(a[i] - 1)
	for i in range(x // 2, n // 2):
		a.append(a[i] + 1)
	print(*a)


for t in range(int(input())):
	n = int(input())
	halfOfArray = n // 2
	if halfOfArray % 2 == 1:
		print('NO')
	elif halfOfArray % 2 == 0:
		print('YES')
		c = []
		a = [0] * halfOfArray
		for i in range(halfOfArray):
			a[i] = 2 * i + 2
			c.append(2 * i + 2)
		sa = sum(a)
		b = [0] * halfOfArray
		for i in range(halfOfArray - 1):
			b[i] = 2 * i + 1
			c.append(2 * i + 1)
		sb = sum(b)
		b[halfOfArray - 1] = sa - sb
		c.append(b[halfOfArray - 1])
		print(' '.join((str(x) for x in c)))


def solve(n):
	if n % 4 != 0:
		print('NO')
		return
	i = 0
	j = n - 1
	e = 0
	o = 1
	l = [0] * n
	while i != j and i < n and (j >= 0):
		l[i] = e
		l[j] = o
		e += 2
		o += 2
		i += 1
		j -= 1
	l = l[::-1]
	l[0] = l[0] + n // 2
	print('YES')
	for i in l:
		print(i, end=' ')
	return
t = int(input())
while t:
	t = t - 1
	n = int(input())
	solve(n)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		r = []
		q = []
		s = 0
		s1 = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				r.append(i)
				s = s + i
			else:
				q.append(i)
				s1 = s1 + i
		q[-1] = s - s1 + q[-1]
		a = r + q
		print('YES')
		print(*a)


import math
for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		d = 2
		for i in range(1, n // 2 + 1):
			print(d * i, end=' ')
		d = 1
		for i in range(n // 2 - 1):
			print(2 * i + 1, end=' ')
		k = n // 2
		g = k * (k + 1) - (k - 1) ** 2
		print(g)


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(n,) = I()
	if n // 2 % 2:
		print('NO')
		continue
	else:
		print('YES')
	an = [2 * i for i in range(1, n // 2 + 1)]
	an += [2 * i + 1 for i in range(n // 2 - 1)]
	print(*an, n + (n - 1) // 2)


import sys
import os
from io import IOBase, BytesIO
import math
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

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

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	lst = []
	for p in range(n + 1):
		if prime[p]:
			lst.append(p)
	return lst

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	for _ in range(int(sin())):
		n = int(sin())
		half = int(n / 2)
		if half % 2 != 0:
			print('NO')
		else:
			lst = [0] * n
			print('YES')
			num = 2
			sm = 0
			sm1 = 0
			for i in range(half):
				lst[i] = num
				sm += num
				num += 2
			num = 1
			for i in range(half):
				lst[i + half] = num
				if i + half != n - 1:
					sm1 += num
				num += 2
			lst[-1] = sm - sm1
			print(*lst)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
main()


from sys import stdin, stdout
for case in range(int(stdin.readline())):
	(n, k) = [int(x) for x in stdin.readline().split()]
	a = [int(x) for x in stdin.readline().split()]
	a1 = a[:n // 2]
	a2 = a[n // 2:][::-1]
	for x in range(n // 2):
		if a1[x] > a2[x]:
			(a1[x], a2[x]) = (a2[x], a1[x])
	lows = {}
	lowCount = [0 for x in range(max(a1) + 1)]
	highCount = [0 for x in range(max(a2) + 1)]
	for x in a1:
		lowCount[x] += 1
	for x in a2:
		highCount[x] += 1
	lowSums = [highCount[0]]
	highSums = [lowCount[-1]]
	for x in highCount[1:]:
		lowSums.append(lowSums[-1] + x)
	for x in lowCount[:-1][::-1]:
		highSums.append(highSums[-1] + x)
	highSums = highSums[::-1]
	sums = {}
	for x in range(n // 2):
		if a1[x] + a2[x] in sums:
			sums[a1[x] + a2[x]] += 1
		else:
			sums[a1[x] + a2[x]] = 1
	best = n // 2
	for x in sums:
		total = n // 2 - sums[x]
		if x > k:
			total += lowSums[x - k - 1]
		if x < len(highSums):
			total += highSums[x]
		best = min(best, total)
	print(best)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		s = 0
		i = 0
		e = 0
		while i < n // 2:
			e += 2
			s += e
			i += 1
			print(e, end=' ')
		i = 1
		ns = 0
		e = -1
		while i < n // 2:
			e += 2
			ns += e
			i += 1
			print(e, end=' ')
		print(s - ns)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		l1 = []
		l2 = []
		suma = 0
		x = 2
		y = 1
		while len(l1) < n // 2:
			l1.append(x)
			suma += x
			x += 2
		while len(l2) < n // 2 - 1:
			l2.append(y)
			suma -= y
			y += 2
		l2.append(suma)
		print('YES')
		print(*l1, *l2, sep=' ')


def dkwpwn(num):
	ans = []
	if num % 4:
		return 'NO'
	for i in range(num // 4):
		oi = 1 + 3 * i
		ans.append(str(oi * 2))
		ans.append(str(oi * 2 + 2))
	for i in range(num // 4):
		oi = 1 + 3 * i
		ans.append(str(oi * 2 - 1))
		ans.append(str(oi * 2 + 3))
	print('YES')
	return ' '.join(ans)
t = int(input())
for _ in range(t):
	num = int(input())
	print(dkwpwn(num))


n = int(input())
for i in range(n):
	a = int(input())
	if a % 4 != 0:
		print('NO')
	else:
		print('YES')
		(r, z) = ([], [])
		for i in range(1, int(a / 2) + 1):
			r.append(2 * i)
			z.append(2 * i - 1)
		z[-1] = sum(r) - sum(z[:-1])
		r += z
		print(*r)


from collections import defaultdict
from collections import Counter

def ispow(n):
	if n * (n + 1) // 2 % 2 == 0:
		return True
	return False
for _ in range(int(input())):
	n = int(input())
	if n <= 2:
		print('NO')
	elif ispow(n):
		arr = [i for i in range(2, n + 1, 2)]
		i = 1
		s = sum(arr)
		s1 = 0
		while i < n - 1:
			arr.append(i)
			s1 += i
			i += 2
		arr.append(s - s1)
		print('YES')
		print(*arr)
	else:
		print('NO')


def Balanced_Array(n):
	if n % 4 != 0:
		print('NO')
	else:
		li1 = [2 * i for i in range(1, n // 2 + 1)]
		li2 = [2 * i - 1 for i in range(1, n // 2)]
		li2.append(2 * (n // 2) - 1 + n // 2)
		li = li1 + li2
		print('YES')
		[print(i, end=' ') for i in li]
for _ in range(int(input())):
	n = input()
	Balanced_Array(int(n))


T = int(input())
for i in range(T):
	n = float(input())
	s1 = s2 = 0
	if n % 4 == 0:
		print('YES')
		for i in range(1, int(n / 2) + 1):
			print(2 * i, end=' ')
			s1 += 2 * i
		for i in range(0, int(n / 2) - 1):
			print(2 * i + 1, end=' ')
			s2 += 2 * i + 1
		print(s1 - s2)
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict
INF = float('inf')

def solution(arr, n, k):
	pairs = []
	for i in range(n // 2):
		the_pair = (arr[i], arr[n - i - 1])
		pairs.append((min(the_pair), max(the_pair)))
	pref = [0] * (2 * k + 5)
	the_map = defaultdict(int)
	for pair in pairs:
		(l, r) = (pair[0] + 1, pair[1] + k)
		the_map[pair[0] + pair[1]] += 1
		pref[l] += 1
		pref[r + 1] -= 1
	sums = 0
	for i in range(2, 2 * k + 5):
		sums += pref[i]
		pref[i] = sums
	res = n // 2
	for i in range(2, 2 * k + 5):
		zero = the_map[i]
		one = pref[i] - zero
		two = n // 2 - (one + zero)
		res = min(one + two * 2, res)
	write(res)

def main():
	for _ in range(r_int()):
		(n, k) = r_array()
		arr = r_array()
		solution(arr, n, k)
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()


for _ in range(int(input())):
	n = int(input())
	if not n % 4:
		print('YES')
		print(*[i * 2 for i in range(1, n // 2 + 1)], *[i * 2 + 1 for i in range(n // 2 - 1)], n - 1 + n // 2)
	else:
		print('NO')


t = int(input())
Ans = ''
for p in range(t):
	n = int(input())
	ans_even = ''
	even = 2
	s_even = 0
	ans_odd = ''
	s_odd = 0
	odd = 1
	if n // 2 % 2 == 0:
		for i in range(n // 2):
			ans_even += str(even) + ' '
			s_even += even
			even += 2
			if i != n // 2 - 1:
				ans_odd += str(odd) + ' '
				s_odd += odd
				odd += 2
			else:
				odd = s_even - s_odd
				ans_odd += str(odd) + ' '
		Ans += 'YES\n'
		Ans += ans_even + ans_odd + '\n'
	else:
		Ans += 'NO\n'
print(Ans)


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	m = 1
	oddsum = 0
	if n % 4 == 0:
		print('YES')
		sum = 0
		for i in range(1, int(n / 2) + 1):
			print(int(2 * i), end=' ')
			sum = sum + 2 * i
		for j in range(0, n // 2 - 1):
			print(m, end=' ')
			oddsum = oddsum + m
			m = m + 2
		print(int(sum - oddsum))
	else:
		print('NO')


def solve(n, k, arr):
	temp = [0 for i in range(0, 2 * k + 10)]
	for i in range(0, n // 2):
		v1 = arr[i]
		v2 = arr[n - 1 - i]
		p1 = min(v1, v2) + 1
		p2 = v1 + v2
		p3 = max(v1, v2) + k
		temp[2] += 2
		temp[p1] -= 1
		temp[p2] -= 1
		temp[p2 + 1] += 1
		temp[p3 + 1] += 1
	res = n
	cur = 0
	for i in range(2, 2 * k + 1):
		cur += temp[i]
		res = min(cur, res)
	return res
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	res = solve(n, k, arr)
	print(res)


for i in range(0, int(input())):
	t = int(input())
	if t % 4 == 2:
		print('NO')
	else:
		print('YES')
		lista = []
		for i in range(1, int(t / 2) + 1):
			lista.append(2 * i)
		for i in range(1, int(t / 2)):
			lista.append(2 * i - 1)
		lista.append(2 * int(t / 2) - 1 + int(t / 2))
		print(*lista)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
		continue
	eve = []
	odd = []
	for i in range(1, n + 1, 2):
		odd += [i]
	for i in range(2, n + 1, 2):
		eve += [i]
	odd[-1] = eve[-1] + n // 2 - 1
	print('YES')
	print(*eve + odd)


n = int(input().strip())
for i in range(n):
	n = int(input().strip())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		s1 = [x for x in range(2, n + 1, 2)]
		s2 = [y for y in range(1, n - 1, 2)]
		s2.extend([sum(s1) - sum(s2)])
		print(' '.join((str(x) for x in s1)) + ' ' + ' '.join((str(y) for y in s2)))


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 is 1:
		print('NO')
	else:
		(even, odd) = (2, 1)
		(evenList, oddList) = ([], [])
		for i in range(n // 2 - 1):
			evenList.append(even)
			oddList.append(odd)
			even += 2
			odd += 2
		evenList.append(even)
		oddList.append(sum(evenList) - sum(oddList))
		print('YES')
		print(*evenList, end=' ')
		print(*oddList)


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		a = [2 * x for x in range(1, n // 2 + 1)]
		b = [2 * x + 1 for x in range(1, n // 2 + 1)]
		for i in range(n // 4):
			b[i] -= 2
		ar = a + b
		print('YES')
		print(' '.join(list(map(str, ar))))
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	cnt = [0] * (2 * k + 1)
	pref = [0] * (2 * k + 2)
	for i in range(n // 2):
		a = A[i]
		b = A[n - i - 1]
		cnt[a + b] += 1
		min_sum = min(a, b) + 1
		max_sum = max(a, b) + k
		pref[min_sum] += 1
		pref[max_sum + 1] -= 1
	for i in range(2, len(pref)):
		pref[i] += pref[i - 1]
	ans = 10 ** 6
	for x in range(2, 2 * k + 1):
		temp = pref[x] - cnt[x] + (n // 2 - pref[x]) * 2
		ans = min(ans, temp)
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	x = int(n // 2)
	if x % 2 == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, x + 1):
			print(str(i * 2), end=' ')
		for i in range(x - 1):
			print(str(2 * i + 1), end=' ')
		print(str(x * (x + 1) - (x - 1) ** 2))


import bisect
import collections
t = int(input())
for case_num in range(t):
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	x = [a[i] + a[n - 1 - i] for i in range(n // 2)]
	x = collections.Counter(x)
	y = [min(a[i], a[n - 1 - i]) + 1 for i in range(n // 2)]
	z = [max(a[i], a[n - 1 - i]) + k for i in range(n // 2)]
	y.sort()
	z.sort()
	ans = n // 2
	for i in range(2, 2 * k + 1):
		zero = x[i]
		two = bisect.bisect_left(z, i) + n // 2 - bisect.bisect_right(y, i)
		one = n // 2 - zero - two
		ans = min(ans, one + two * 2)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
	else:
		even_array = [x for x in range(2, n + 1, 2)]
		odd_array = [x for x in range(1, n + 1, 2)]
		odd_array[-1] += int(n / 2)
		print('YES')
		even_array += odd_array
		print(*even_array)


for i in range(int(input())):
	n = int(input())
	s = 'NO'
	e = list()
	o = list()
	if n / 2 % 2 == 0:
		s = 'YES'
		for i in range(n - n // 2, n + n // 2 + 1):
			if i % 2 == 0 and i != n:
				e.append(i)
			elif i != n:
				o.append(i)
		a = e + o
		print(s)
		for i in range(n):
			print(a[i], end=' ')
		print()
	else:
		print(s)


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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 sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
t = int(input())
inf = float('INF')

def u(i, v):
	i += 2 * k
	tr[i] += v
	while i > 1:
		i >>= 1
		tr[i] = tr[i << 1] + tr[i << 1 | 1]

def q(i):
	l = 2 * k + 1
	r = i + 2 * k + 1
	res = 0
	while l < r:
		if l & 1:
			res += tr[l]
			l += 1
		if r & 1:
			r -= 1
			res += tr[r]
		l >>= 1
		r >>= 1
	return res
for _ in range(t):
	(n, k) = map(int, input().split())
	aa = list(map(int, input().split()))
	tr = [0 for i in range(4 * (2 * k + 5))]
	for i in range(n // 2):
		x = aa[i] + aa[n - 1 - i]
		a = 1 + min(aa[i], aa[n - 1 - i])
		b = k + max(aa[i], aa[n - 1 - i])
		if a < x and x < b:
			u(1, 2)
			u(a - 1, -1)
			u(x - 1, -1)
			u(x, 1)
			u(b, 1)
		elif x == a and x == b:
			u(1, 2)
			u(x - 1, -2)
			u(x, 2)
		elif x == a:
			u(1, 2)
			u(x - 1, -2)
			u(x, 1)
			u(b, 1)
		elif x == b:
			u(1, 2)
			u(a - 1, -1)
			u(x - 1, -1)
			u(x, 2)
	ans = n
	for i in range(1, 2 * k):
		ans = min(ans, q(i))
	print(ans)


T = int(input())

def main():
	n = int(input())
	if n % 4 == 2:
		return 'NO'
	else:
		a = []
		for k in range(1, int(n / 2) + 1):
			a.append(str(k))
		a = a + a
		a[int(n / 2) - 1] = str(int(a[int(n / 2) - 1]) + int(n / 4))
		for k in range(0, int(n / 2)):
			a[k] = str(int(a[k]) * 2)
			a[k + int(n / 2)] = str(int(a[k + int(n / 2)]) * 2 + 1)
		myString = ' '.join(a)
		return 'YES \n' + myString
for _ in range(T):
	print(main())


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		arr = []
		cnt = 2
		for i in range(n // 2):
			arr.append(cnt)
			cnt += 2
		s = sum(arr)
		o = 0
		cnt = 1
		for i in range(n // 2 - 1):
			arr.append(cnt)
			o += cnt
			cnt += 2
		arr.append(s - o)
		print(*arr)


ans = []
arrys = []
for i in range(int(input())):
	n = int(input())
	temp = n % 4
	if temp != 0:
		ans.append('NO')
	else:
		ans.append('YES')
		temp = [(i + 1) * 2 for i in range(int(n / 2))]
		temp2 = [i * 2 + 1 if i < n / 4 else i * 2 + 3 for i in range(int(n / 2))]
		temp.extend(temp2)
		arrys.append(temp)
i = 0
for a in ans:
	print(a)
	if a == 'YES':
		s = ' '.join((str(x) for x in arrys[i]))
		print(s)
		i += 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cnt = [0] * (k * 2 + 1)
	pref = [0] * (k * 2 + 1 + 1)
	prefpref = [0] * (k * 2 + 1 + 1)
	for i in range(n // 2):
		cnt[a[i] + a[-i - 1]] += 1
		pref[min(a[i], a[-i - 1]) + 1] += 1
		pref[max(a[i], a[-i - 1]) + k + 1] -= 1
	prefpref[0] = pref[0]
	for i in range(1, k * 2 + 1):
		prefpref[i] = prefpref[i - 1] + pref[i]
	ans = n + 1
	for i in range(2, 2 * k + 1):
		ans = min(ans, prefpref[i] - cnt[i] + (n // 2 - prefpref[i]) * 2)
	print(ans)


from collections import deque
tc = int(input())
for i in range(tc):
	n = int(input())
	if n // 2 % 2 == 0:
		print('YES')
		l = deque()
		for i in range(n // 2):
			l.append((i + 1) * 2)
		for i in range(n // 2):
			l.append(l[i] - 1)
		l[-1] = l[n // 2 - 1] + (n // 2 - 1)
		print(' '.join([str(x) for x in l]))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	k = []
	for t in range(2, n + 1, 2):
		l.append(t)
	for t in range(1, n + 1, 2):
		k.append(t)
	k.pop()
	li = sum(l)
	ki = sum(k)
	x = li - ki
	if x % 2:
		print('YES')
		print(*l, *k, x)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [0] * n
	if n % 4 == 0:
		print('YES')
		l = 0
		r = n // 2
		for i in range(n):
			if (i + 1) % 2 == 0:
				arr[l] = i + 1
				l += 1
			else:
				if i == n - 1:
					break
				arr[r] = i + 1
				r += 1
		arr[n - 1] = 3 * (n // 2) - 1
		print(*arr, sep=' ')
	else:
		print('NO')


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 4:
		print('NO')
	else:
		print('YES')
		for i in range(2, n + 1, 2):
			print(i, end=' ')
		for i in range(1, n - 2, 2):
			print(i, end=' ')
		print(n + n // 2 - 1)


t = int(input())
for i in range(t):
	n = int(input())
	if n / 2 % 2 == 0:
		e_sum = 0
		o_sum = 0
		e = []
		o = []
		a = 2
		while len(o) <= n / 2 and len(e) <= n / 2:
			e_sum += a
			e.append(a)
			if len(e) != n / 2:
				o_sum += a - 1
				o.append(a - 1)
			else:
				o.append(e_sum - o_sum)
				o_sum += e_sum - o_sum
				break
			a += 2
		print('YES')
		print(*e + o)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = 'NO'
	arr = None
	if n // 2 % 2 == 0:
		ans = 'YES'
		arr = []
		s = 0
		for i in range(2, n + 1, 2):
			s += i
			arr.append(i)
		for i in range(1, n - 1, 2):
			s -= i
			arr.append(i)
		arr.append(s)
	print(ans)
	if arr is not None:
		print(' '.join(map(str, arr)))


for _ in range(int(input())):
	n = int(input())
	if n / 2 % 2 != 0:
		print('NO')
		continue
	else:
		a = list((x for x in range(2, n + 1, 2)))
		b = list((x for x in range(1, n - 2, 2)))
		b.append(int((n / 2) ** 2 + n / 2 - (n / 2 - 1) ** 2))
		print('YES')
		print(*a, *b)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		a = []
		chet = 2
		for j in range(int(n / 2)):
			a.append(chet)
			chet += 2
		chet = 2
		for j in range(int(n / 2 - 1)):
			a.append(chet - 1)
			chet += 2
		a.append(int(n + (n / 2 - 1)))
		s = ''
		for j in range(len(a)):
			s += str(a[j])
			s += ' '
		print('YES')
		print(s)
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	temp = int(input())
	temp1 = temp // 2
	if temp1 % 2 == 0:
		print('YES')
		for j in range(1, temp1 + 1):
			print(2 * j, end=' ')
		for j in range(0, temp1 - 1):
			print(2 * j + 1, end=' ')
		print((temp1 + 1) * temp1 - (temp1 - 1) ** 2)
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	lst = []
	if n % 4 == 0:
		print('YES')
		for i in range(n + 1):
			if i > 0 and i % 2 == 0:
				lst.append(i)
		for x in range(n + 1):
			if x > 0 and x % 2 != 0:
				lst.append(x)
		lst[-1] = lst[-1] + n // 2
		print(*lst)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		print(*(i for i in range(1, 3 * n // 2 + 1) if i % 6 == 2 or i % 6 == 4), *(i for i in range(1, 3 * n // 2 + 1) if i % 6 == 1 or i % 6 == 5))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		l = []
		left = n // 2 + 1
		now = n // 2
		for i in range(1, left):
			l.append(2 * i)
		for i in range(left - 2):
			l.append(2 * i + 1)
		k = now * (now + 1)
		k -= (now - 1) ** 2
		l.append(k)
		print('YES')
		print(*l)


for _ in range(int(input())):
	n = int(input())
	if n // 2 % 2 == 1:
		print('NO')
	else:
		print('YES')
		first = list(range(2, n + 1, 2))
		second = list(range(1, n - 1, 2))
		res = first + second + [sum(first) - sum(second)]
		print(' '.join(list(map(str, res))))


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = []
	l2 = []
	for i in range(1, n + 1):
		if i % 2 == 1:
			l1.append(i)
		else:
			l2.append(i)
	n1 = sum(l1)
	n2 = sum(l2)
	if n2 > n1:
		num = n2 - n1
		l1[-1] = l1[-1] + num
		if l1[-1] % 2 == 0:
			l1[-1] = 1
	if len(l1) == len(l2) and sum(l1) == sum(l2):
		print('YES')
		for i in l2:
			print(i, end=' ')
		for i in l1:
			print(i, end=' ')
		print()
	else:
		print('NO')


test_case = int(input())
while test_case:
	inp = int(input())
	if inp % 4 != 0:
		print('NO')
	else:
		print('YES')
		for i in range(2, inp + 1, 2):
			print(i, end=' ')
		for i in range(1, inp - 1, 2):
			print(i, end=' ')
		print(inp + inp // 2 - 1)
	test_case -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	if 1 == 1:
		ans = []
		ans1 = []
		i1 = 3
		i2 = 2 * n - 1
		x1 = 2
		x2 = 2 * n
		sum1 = 0
		sum2 = 0
		if n == 2 or n // 2 % 2 == 1:
			print('NO')
			continue
		while len(ans) < n // 2 and x1 < x2 and (i1 < i2):
			ans.append(i1)
			ans.append(i2)
			sum1 += i1 + i2
			i1 += 2
			i2 -= 2
			ans1.append(x1)
			ans1.append(x2)
			sum2 += x1 + x2
			x1 += 2
			x2 -= 2
			if len(ans) == n // 2:
				break
		c = ans1 + ans
		if sum1 == sum2:
			print('YES')
			print(*c)
		else:
			print('NO')


n = int(input())
for _ in range(n):
	m = int(input())
	if m % 4 != 0:
		print('NO')
	else:
		print('YES')
		k = m // 4
		v = []
		for i in range(1, 2 * k + 1):
			v.append(i * 2)
		for i in range(1, 2 * k):
			v.append(i * 2 - 1)
		v.append(6 * k - 1)
		for el in v:
			print(str(el), end=' ')


def solve():
	n = int(input())
	if n % 4 != 0:
		print('NO')
		return
	x = [0 for _ in range(n)]
	for i in range(n // 2):
		e = 4 * i + 2
		x[i] = e
		x[n // 2 + i] = e - 1 if i % 2 == 0 else e + 1
	print('YES')
	print(' '.join(map(str, x)))

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


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	(n, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	c = []
	for i in range(n // 2):
		c.append((min(a[i] + 1, a[n - i - 1] + 1), -1))
		c.append((max(a[i] + k, a[n - i - 1] + k) + 1, 1))
	for i in range(n // 2):
		c.append((a[i] + a[n - i - 1], -1))
		c.append((a[i] + a[n - i - 1] + 1, 1))
	d = {}
	for i in range(len(c)):
		d[c[i][0]] = d.get(c[i][0], 0) + c[i][1]
	counter = n
	val_res = n
	for (key, val) in sorted(list(d.items())):
		counter += val
		if val_res > counter:
			val_res = counter
	print(val_res)


t = int(input())
for k in range(t):
	n = int(input())
	nn = n
	if n == 2:
		print('NO')
		continue
	n = n // 2
	if n % 2 == 1:
		print('NO')
		continue
	print('YES')
	a = 0
	s = 0
	for i in range(nn // 2):
		a = a + 2
		s = s + a
		print(a, end=' ')
	b = 1
	for i in range(nn // 2 - 1):
		print(b, end=' ')
		s = s - b
		b = b + 2
	print(s)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
from collections import deque
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
t = ni()
for i in range(t):
	n = ni()
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		li = [2 * x for x in range(1, n // 2 + 1)]
		t1 = sum(li)
		t2 = 0
		for j in range(1, n // 2):
			li.append(2 * j - 1)
			t2 += 2 * j - 1
		li.append(t1 - t2)
		print(*li)


import sys
input = sys.stdin.readline

def bs(l, target, n):
	low = 0
	high = n
	ans = -1
	while low <= high:
		mid = low + (high - low) // 2
		if l[mid] <= target:
			ans = max(ans, mid)
			low = mid + 1
		else:
			high = mid - 1
	return ans
t = int(input())
for r in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	d = {}
	start = []
	end = []
	i = 0
	j = n - 1
	while i < j:
		start.append(min(l[i], l[j]) + 1)
		end.append(max(l[i], l[j]) + k)
		try:
			d[l[i] + l[j]] += 1
		except:
			d[l[i] + l[j]] = 1
		i += 1
		j -= 1
	start.sort()
	end.sort()
	mini = 999999999999999
	for i in range(1, 2 * k + 1):
		a = bs(start, i, len(start) - 1) + 1
		b = bs(end, i - 1, len(end) - 1) + 1
		one = a - b
		zero = 0
		try:
			zero = d[i]
		except:
			pass
		twos = n // 2 - one
		ans = twos * 2 + (one - zero)
		mini = min(mini, ans)
	print(mini)


import sys
input = sys.stdin.buffer.readline
import collections

def solve(n, k, arr):
	d = collections.defaultdict(int)
	for i in range(n // 2):
		t = arr[i] + arr[n - 1 - i]
		d[t] += 1
	count_list = sorted(set(d.values()))
	ans = float('inf')
	for i in count_list:
		upper_near_mid_v = float('inf')
		v1 = 0
		lower_near_mid_v = float('inf')
		v2 = 0
		for j in d:
			if d[j] == i:
				if j > k:
					if j - k < upper_near_mid_v:
						upper_near_mid_v = j - k
						v1 = j
				elif k - j < lower_near_mid_v:
					lower_near_mid_v = k - j
					v2 = j

		def chk(v):
			if not v:
				return float('inf')
			t = 0
			for i in range(n // 2):
				temp = arr[i] + arr[n - 1 - i]
				if temp != v:
					max_v = max(arr[i], arr[n - 1 - i])
					min_v = min(arr[i], arr[n - 1 - i])
					if temp > v:
						if max_v - 1 >= temp - v:
							t += 1
						else:
							t += 2
					elif temp < v:
						if k - min_v >= v - temp:
							t += 1
						else:
							t += 2
			return t
		ans = min(ans, chk(v1), chk(v2))
	return min(ans, n // 2)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = solve(n, k, arr)
	print(ans)


class inp:

	@staticmethod
	def int():
		return int(input())

def main():
	t = inp.int()
	for _ in range(t):
		n = inp.int()
		if n % 4 != 0:
			print('NO')
		else:
			print('YES')
			print(2, end=' ')
			e = 2
			for i in range(n // 2 - 1):
				if i % 2 == 0:
					e += 2
				else:
					e += 4
				print(e, end=' ')
			o = 1
			for i in range(n // 2 - 1):
				if i % 2 == 0:
					o += 4
				else:
					o += 2
				print(o, end=' ')
			print(1)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = n // 2
	if a % 2 == 1:
		print('NO')
	else:
		print('YES')
		b = []
		c = 2
		while c <= n:
			b.append(c)
			c += 2
		s = sum(b)
		d = []
		i = 1
		while i <= n - 3:
			d.append(i)
			i += 2
		s1 = sum(d)
		d.append(s - s1)
		b = b + d
		print(*b)


for i in range(int(input())):
	a = int(input())
	odd = []
	even = []
	for i in range(1, a * 2):
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	even = even[:a // 2]
	odd = odd[:a // 2]
	k = abs(sum(odd) - sum(even))
	kd = odd[-1] + k
	if kd % 2 != 0:
		odd[-1] = kd
	else:
		print('NO')
	if sum(even) == sum(odd):
		print('YES')
		even.extend(odd)
		for i in range(len(even)):
			print(even[i], end=' ')


for t in range(int(input())):
	n = int(input())
	if n // 2 & 1:
		print('NO')
		continue
	l = []
	for i in range(1, n, 2):
		l.append(2 * i)
	le = len(l)
	print('YES')
	for i in range(le):
		if i % 2 == 0:
			l.append(l[i] - 1)
		else:
			l.append(l[i] + 1)
	print(*l, sep=' ')


tc = int(input().strip())

def solve():
	n = int(input().strip())
	pp = n // 2
	if pp % 2 != 0:
		print('NO')
	else:
		print('YES')
		print(*[2 * i for i in range(1, pp + 1)], *[2 * i - 1 for i in range(1, pp)], 2 * pp + pp - 1)
for t in range(1, tc + 1):
	solve()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	b = list(map(int, input().split()))
	a = b[:int(n // 2)]
	c = b[int(n // 2):]
	c.reverse()
	d = [0] * (2 * k + 2)
	f = dict()
	for j in range(1, 2 * k + 1):
		f[j] = 0
	for j in range(n // 2):
		r = a[j] + c[j]
		f[r] += 1
		x = min(a[j], c[j]) + 1
		y = max(a[j], c[j]) + k
		d[x] += 1
		d[y + 1] -= 1
	for i in range(1, 2 * k + 2):
		d[i] += d[i - 1]
	m = 100000000000000000
	for j in range(1, 2 * k + 1):
		h = d[j] - f[j] + (int(n // 2) - d[j]) * 2
		m = min(m, h)
	print(m)


def solve(n):
	if n == 2 or n // 2 % 2 == 1:
		print('NO')
	else:
		evsum = oddsum = 0
		ans = []
		for i in range(0, n // 2):
			e = 2 * (i + 1)
			ans.append(e)
			evsum += e
		for i in range(0, n // 2):
			o = 2 * i + 1
			ans.append(o)
			if i < n // 2 - 1:
				oddsum += o
		ans[-1] = evsum - oddsum
		print('YES')
		print(*ans, sep=' ')
for i in range(int(input())):
	n = int(input())
	solve(n)


t = int(input())
for i in range(t):
	n = int(input())
	mid = int(n / 2)
	list1 = []
	if mid % 2 == 1:
		print('NO')
	else:
		for j in range(mid):
			list1.append(4 * (j + 1))
		for k in range(mid, n):
			if k % 2 == 0:
				h = -1
			else:
				h = 1
			list1.append(list1[k - mid] + h)
		print('YES')
		print(*list1)


try:
	for _ in range(int(input())):
		n = int(input())
		l = []
		m = []
		a = n // 2
		if a % 2 == 1:
			print('NO')
		else:
			for i in range(1, n + 1):
				if i % 2 == 0:
					l.append(i)
				else:
					m.append(i)
			m[-1] = m[-1] + a
			print('YES')
			print(*l, end=' ')
			print(*m)
except:
	pass


def main():
	n = int(input())
	for _ in range(n):
		m = int(input())
		if m % 4 != 0:
			print('NO')
		else:
			print('YES')
			(a, b) = ([], [])
			for i in range(m // 2):
				a.append(str(2 * i + 2))
			s = 0
			for i in range(m // 2 - 1):
				s += 2 * i + 1
				b.append(str(2 * i + 1))
			b.append(str(int((m * m + 2 * m) / 4 - s)))
			print(' '.join(a) + ' ' + ' '.join(b))
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	num1 = []
	if n % 4 != 0:
		print('NO')
		a += 1
	if n % 4 == 0:
		for i in range(n // 2):
			num1.append(2 * (i + 1))
		for i in range(n // 4):
			num1.append(2 * i + 1)
		for i in range(n // 4):
			if i == 0:
				num1.append(num1[-1] + 4)
			else:
				num1.append(num1[-1] + 2)
	if a == 0:
		print('YES')
		print(' '.join((str(x) for x in num1)))


def solve(n):
	if n % 4 != 0:
		print('NO')
	else:
		arr1 = list(range(2, n + 1, 2))
		arr2 = list(range(1, n, 2))
		arr2[-1] = (3 * n - 2) // 2
		s = ''
		for x in arr1:
			s += str(x) + ' '
		for x in arr2:
			s += str(x) + ' '
		s = s[:-1]
		print('YES')
		print(s)
for _ in range(int(input())):
	solve(int(input()))


def solver(n):
	n //= 2
	if n % 2 == 1:
		print('NO')
	else:
		print('YES')
		s = 0
		for i in range(1, n + 1):
			print(2 * i, end=' ')
		for i in range(n + 1):
			if i == n // 2:
				continue
			print(2 * i + 1, end=' ')
		print()
t = int(input())
for i in range(t):
	n = int(input())
	solver(n)


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	cum = [0 for _ in range(2 * k + 2)]
	for i in range(n // 2):
		(x, y) = (a[i], a[n - i - 1])
		cum[2] += 2
		cum[min(x, y) + 1] -= 1
		cum[x + y] -= 1
		cum[x + y + 1] += 1
		cum[max(x, y) + k + 1] += 1
		cum[2 * k + 1] -= 2
	ans = n
	for i in range(2, 2 * k + 1):
		cum[i] += cum[i - 1]
		ans = min(ans, cum[i])
	print(ans)


def func(n):
	if n // 2 % 2 > 0:
		print('NO')
		return None
	print('YES')
	arr = [a for a in range(2, n + 1, 2)]
	arr += [a for a in range(1, n + 1, 2)]
	arr[-1] = arr[-1] + n // 2
	print(' '.join(list(map(str, arr))))
n = int(input())
data = []
for _ in range(n):
	data.append(int(input()))
for n in data:
	func(n)


t = int(input())
for _ in range(t):
	n = int(input())
	if float(n / 4).is_integer():
		print('YES')
		a = 0
		for _ in range(n // 4):
			a += 2
			print(a, end=' ')
		a = 5 * 10 ** 5
		for _ in range(n // 4):
			a += 2
			print(a, end=' ')
		a = -1
		for _ in range(n // 4):
			a += 2
			print(a, end=' ')
		a = 5 * 10 ** 5 + 1
		for _ in range(n // 4):
			a += 2
			print(a, end=' ')
		print()
	else:
		print('NO')


from collections import Counter
t = int(input())
for T in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pair = []
	for i in range(n // 2):
		pair.append(a[i] + a[n - i - 1])
	f = Counter(pair)
	event = []
	for i in range(n // 2):
		event.append([min(a[i], a[n - i - 1]) + 1, -1])
		event.append([max(a[i], a[n - i - 1]) + k + 1, +1])
	event.sort()
	it = 0
	ans = n + 100
	offset = n
	for x in range(1, 2 * k + 1):
		while it < n and event[it][0] <= x:
			offset += event[it][1]
			it += 1
		ans = min(ans, offset - f[x])
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	even = 0
	odd = 0
	if n / 2 % 2 == 0:
		print('YES')
		for x in range(2, n + 1, 2):
			even += x
			arr.append(str(x))
		for x in range(1, n - 1, 2):
			odd += x
			arr.append(str(x))
		arr.append(str(even - odd))
		print(' '.join(arr))
	else:
		print('NO')


n = int(input())
l = []
for i in range(n):
	i = int(input())
	l += [i]
for r in l:
	if int(r) == 2 or int(r) % 4 != 0:
		print('NO')
	else:
		c = 0
		d = 1
		l1 = []
		l2 = []
		for k in range(int(int(r) / 2)):
			c += 2
			l1.append(c)
		for q in range(int(int(r) / 2) - 1):
			l2.append(d)
			d += 2
		l2.append(l1[int(int(r) / 2) - 1] + int(int(r) / 2) - 1)
		ans = l1 + l2
		print('YES')
		for t in ans:
			print(t, end=' ')
		print('')


import sys
import math
from collections import defaultdict
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	kk = k << 1
	a = [0] * (kk + 5)
	d = defaultdict(int)
	p = []
	nn = n >> 1
	for i in range(nn):
		pp = (min(l[i], l[n - i - 1]), max(l[i], l[n - i - 1]))
		p.append(pp)
		a[pp[0] + 1] += 1
		a[pp[1] + k + 1] -= 1
		d[pp[0] + pp[1]] += 1
	ans = n
	for i in range(1, len(a)):
		a[i] += a[i - 1]
	for i in range(2, kk + 1):
		s = a[i] - d[i] + (nn - a[i] << 1)
		ans = min(ans, s)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		sm = 0
		st = 0
		for i in range(n // 2):
			st += 2
			print(st, end=' ')
			sm += st
		st = -1
		for i in range(n // 2 - 1):
			st += 2
			print(st, end=' ')
			sm -= st
		print(sm)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

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

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve():
	(n, k) = LI()
	a = LI()
	size = 2 * k + 1
	dp = [0 for _ in range(2 * k + 2)]
	dp[0] = n
	for i in range(n // 2):
		m = a[i] + a[n - i - 1]
		mr1 = max(a[i], a[n - i - 1]) + k
		ml1 = min(a[i], a[n - i - 1]) + 1
		dp[m + 1] += 1
		dp[mr1 + 1] += 1
		dp[m] -= 1
		dp[ml1] -= 1
	for i in range(2 * k + 1):
		dp[i + 1] += dp[i]
	print(min(dp))
	return
for _ in range(II()):
	solve()


t = int(input())
for _ in range(t):
	[n, k] = map(int, input().split())
	a = [*map(int, input().split())]
	cnt = [0] * (2 * k)
	intervals = [0] * (2 * k)
	for i in range(n // 2):
		v = a[i] + a[n - i - 1]
		cnt[v - 1] += 1
		ma = max(a[i], a[n - i - 1])
		mi = min(a[i], a[n - i - 1])
		intervals[mi] += 1
		if ma + k < 2 * k:
			intervals[ma + k] -= 1
	for i in range(1, 2 * k):
		intervals[i] += intervals[i - 1]
	ans = 1000000000.0
	for i in range(1, 2 * k):
		ans = min(ans, intervals[i] - cnt[i] + (n // 2 - intervals[i]) * 2)
	print(ans)


for tt in range(int(input())):
	n = int(input())
	if n == 2:
		print('NO', end='')
	else:
		(l, e, o, p) = ([], 2, 1, 0)
		while p < n / 2:
			l.append(e)
			e += 2
			p += 1
		(se, so, listodd) = (sum(l), 0, [])
		while so < se:
			listodd.append(o)
			so += o
			o += 2
		if (so - se) % 2 == 0 or so - se not in listodd:
			print('NO', end='')
		else:
			listodd.remove(so - se)
			print('YES')
			for i in l:
				print(i, end=' ')
			for i in listodd:
				print(i, end=' ')
	print()


def sol(k):
	a = []
	b = []
	for i in range(k):
		a.append(6 * i + 2)
		a.append(6 * i + 4)
		b.append(6 * i + 1)
		b.append(6 * i + 5)
	return a + b
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		print(*sol(n // 4))


t = int(input())
for cas in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		eans = []
		oans = []
		esum = osum = 0
		for i in range(1, n + 1):
			if i % 2 == 0:
				eans.append(i)
				esum = esum + i
			else:
				oans.append(i)
				osum = osum + i
		oans[len(oans) - 1] = oans[len(oans) - 1] + esum - osum
		ans = eans + oans
		print('YES')
		for i in ans:
			print(i, end=' ')


t = int(input())
for i in range(t):
	num = int(input())
	ans = 0
	if num == 2:
		ans = 'No'
	elif num % 4 == 2:
		ans = 'No'
	else:
		ans = 'Yes'
		arr = [0] * num
		count = 0
		total = 0
		for k in range(2, num + 2, +2):
			arr[count] = k
			count += 1
			total += k
		for l in range(1, num - 2, +2):
			arr[count] = l
			count += 1
			total = total - l
		arr[num - 1] = total
	if ans == 'No':
		print('NO')
	else:
		print('YES')
		for p in range(num):
			print(arr[p], end=' ')


def solve():
	if n % 4 != 0 or n == 2:
		print('NO')
	else:
		print('YES')
		half = n // 2
		a = [0] * n
		for i in range(1, n + 1):
			if i % 2 == 0:
				a[i // 2 - 1] = i
			else:
				a[half + i // 2] = i
		a[n - 1] += n // 2
		print(' '.join((str(x) for x in a)))
	return
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	solve()


import sys
input = sys.stdin.readline
m = 1000000007

def power(x, y):
	res = 1
	while y > 0:
		if y & 1 == 1:
			res = res * x % m
		y = y >> 1
		x = x * x % m
	return res % m

def main():
	for _ in range(int(input())):
		n = int(input())
		if n % 4 != 0:
			print('NO')
		else:
			l = [i for i in range(2, 2 * (n // 2) + 1, 2)]
			for i in range(n // 2):
				if i < n // 4:
					l.append(l[i] - 1)
				else:
					l.append(l[i] + 1)
			print('YES')
			print(*l)
main()


import math

def s():
	n = int(input())
	a = []
	b = []
	if n == 2 or not int(n / 2) % 2 == 0:
		print('NO')
	else:
		print('YES')
		temp = int(n / 2)
		a.append(1)
		temp2 = 1
		for j in range(1, temp):
			temp2 += 4
			a.append(temp2)
		b.append(2)
		temp2 = 2
		for j in range(1, temp):
			if not j % 2 == 0:
				temp2 += 2
				b.append(temp2)
			else:
				temp2 += 6
				b.append(temp2)
		for k in b:
			print(k, end=' ')
		for k in a:
			print(k, end=' ')
		print()
t = int(input())
for i in range(t):
	s()


def solve():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	h = n // 2
	c = [0] * (2 * k + 2)
	for i in range(h):
		c[0] += 2
		p = a[i] + a[n - i - 1]
		c[p] += -1
		c[p + 1] += 1
		min_sum_1 = min(a[i], a[n - i - 1]) + 1
		max_sum_1 = max(a[i], a[n - i - 1]) + k
		c[min_sum_1] += -1
		c[max_sum_1 + 1] += 1
	s = 0
	for i in range(len(c)):
		s += c[i]
		c[i] = s
	print(min(c))

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


for _ in range(int(input())):
	n = int(input())
	a = n / 2
	if a % 2 == 0:
		l = [2 * x for x in range(1, int(n / 2) + 1)]
		sum1 = sum(l)
		r = [1]
		for i in range(1, int(n / 2) - 1):
			r.append(1 + 2 * i)
		r.append(sum1 - sum(r))
		m = l + r
		l1 = list(map(str, l + r))
		print('YES')
		print(' '.join((str(x) for x in m)))
	else:
		print('NO')


def solve(n):
	even = []
	odd = [1]
	ev = 2
	od = 1
	if n % 4 != 0:
		print('NO')
		return
	else:
		last = int(2 * (n / 4 + 1))
		for i in range(n // 2):
			even.append(ev)
			ev += 2
		for i in range(1, n // 2):
			if i == n / 2 - 1:
				od += last
			else:
				od += 2
			odd.append(od)
	print('YES')
	ans = even + odd
	print(' '.join(map(str, ans)))
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 != 0:
		print('NO')
	else:
		print('YES')
		even_arr = [2]
		odd_arr = [1]
		LEN = n // 2 - 1
		for j in range(LEN):
			even_arr.append(even_arr[-1] + 2)
			odd_arr.append(odd_arr[-1] + 2)
		odd_arr[-1] += LEN + 1
		print(*even_arr + odd_arr)


n = int(input())
for i in range(n):
	a = int(input())
	if a == 2 or a / 2 % 2 != 0:
		print('NO')
	else:
		print('YES')
		x = [j for j in range(1, a + 1) if j % 2 == 0]
		y = [j for j in range(1, a - 1) if j % 2 != 0]
		y.append(sum(x) - sum(y))
		x.extend(list(y))
		for j in x:
			print(j, end=' ')
		print(end='\n')


import sys
t = int(input())
for i in range(t):
	n = int(input())
	count = int(n / 2)
	if count % 2 == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, count + 1):
			if j != 1:
				print(' ', end='')
			print(j * 2, end='')
		for j in range(1, count + 1):
			print(' ', end='')
			if j == count:
				print(j * 2 + count - 1)
			else:
				print(j * 2 - 1, end='')


for _ in range(int(input())):
	n = int(input())
	if n * (n - 1) / 2 % 2 == 0:
		a = list(range(2, n + 1, 2))
		b = list(range(1, n - 1, 2))
		print('YES')
		print(*list(a + b + [sum(a) - sum(b)]))
	else:
		print('NO')


for q in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('NO')
	else:
		(l, k) = ([], [])
		for x in range(n // 2):
			l.append(2 * (x + 1))
		for x in range(n // 2 - 1):
			k.append(2 * (x + 1) - 1)
		if (sum(l) - sum(k)) % 2 == 0:
			print('NO')
		else:
			print('YES')
			k.append(sum(l) - sum(k))
			print(*l + k)


import sys
input = sys.stdin.readline
from math import *
import bisect as bs
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 4:
		print('NO')
		continue
	print('YES')
	c = 2
	for i in range(n // 2):
		print(c, end=' ')
		c += 2
	c = 1
	for i in range(n // 4):
		print(c, end=' ')
		c += 2
	c += 2
	for i in range(n // 4):
		print(c, end=' ')
		c += 2
	print()


from itertools import accumulate
for t in range(int(input())):
	(n, k) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	b = [0] * (2 * k + 2)
	c = [0] * (2 * k + 1)
	for i in range(n // 2):
		(x, y) = sorted([arr[i], arr[~i]])
		b[x + 1] += 1
		b[y + k + 1] -= 1
		c[x + y] += 1
	b = list(accumulate(b))
	d = [0] * (2 * k + 1)
	for i in range(2 * k + 1):
		d[i] = n - c[i] - b[i]
	d[0] = n
	d[1] = n
	print(min(d))


t = int(input())
for j in range(t):
	n = int(input())
	arr = []
	sum = 0
	for i in range(2, n + 1, 2):
		arr.append(i)
		sum += i
	if int(n / 2) % 2 == 0 and sum % 2 != 0 or (int(n / 2) % 2 != 0 and sum % 2 == 0):
		print('NO')
	else:
		sum1 = 0
		for i in range(1, n - 1, 2):
			arr.append(i)
			sum1 += i
		arr.append(sum - sum1)
		print('YES')
		print(*arr)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4 == 0:
		print('YES')
		s1 = []
		s2 = []
		for i in range(1, n + 1):
			if i % 2 == 0:
				s1.append(i)
			else:
				s2.append(i)
		s2.pop()
		sum1 = sum(s1) - sum(s2)
		s2.append(sum1)
		s3 = s1 + s2
		print(*s3)
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	frequency = [0] * (2 * k + 1)
	for i in range(n // 2):
		frequency[arr[i] + arr[n - 1 - i]] += 1
	prefix = [0] * (2 * k + 2)
	for i in range(n // 2):
		minVal = min(arr[i], arr[n - 1 - i]) + 1
		maxVal = max(arr[i], arr[n - 1 - i]) + k
		prefix[minVal] += 1
		prefix[maxVal + 1] -= 1
	for i in range(1, 2 * k + 2):
		prefix[i] += prefix[i - 1]
	ans = n + 1
	for i in range(2 * k + 1):
		ans = min(ans, prefix[i] - frequency[i] + (n // 2 - prefix[i]) * 2)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [0] * n
	e = 2
	o = 1
	j = n // 2
	esum = 0
	osum = 0
	for i in range(0, n // 2):
		l[i] = e
		esum = esum + e
		e = e + 2
		if j < n - 1:
			l[j] = o
			osum = osum + o
			o = o + 2
			j = j + 1
	if (esum - osum) % 2 == 0:
		print('NO')
	else:
		l[-1] = esum - osum
		print('YES')
		for i in range(n):
			print(l[i], end=' ')
		print()


import math

def main():
	for _ in range(int(input())):
		n = int(input())
		if n // 2 % 2 == 0:
			a = [2 * i for i in range(1, n // 2 + 1)]
			b = [2 * i - 1 for i in range(1, n // 2)]
			c = sum(a) - sum(b)
			b.append(c)
			print('YES')
			print(' '.join(list(map(str, a))), end=' ')
			print(' '.join(list(map(str, b))))
		else:
			print('NO')
main()


def make_first(n):
	k = 2
	i = 0
	first = []
	while i < n:
		first.append(k)
		k += 2
		i += 1
	return first

def make_second(n, sum_first):
	k = 1
	i = 0
	second = []
	while i < n - 1:
		second.append(k)
		k += 2
		i += 1
	last = sum_first - sum(second)
	second.append(last)
	return second
t = int(input())
n_list = []
i = 0
while i < t:
	n_list.append(int(input()))
	i += 1
for n in n_list:
	if n // 2 % 2 != 0:
		print('NO')
	else:
		print('Yes')
		first = make_first(n // 2)
		second = make_second(n // 2, sum(first))
		first.extend(second)
		ans = [str(a) for a in first]
		print(' '.join(ans))


def main():
	t = int(input())
	while t > 0:
		(n, k) = map(int, input().split())
		arr = [int(e) for e in input().split()]
		mp = {}
		vec = []
		for i in range(int(n / 2)):
			if arr[i] + arr[n - i - 1] not in mp:
				mp[arr[i] + arr[n - i - 1]] = 0
			mp[arr[i] + arr[n - 1 - i]] += 1
			vec.append([min(arr[i], arr[n - i - 1]), max(arr[i], arr[n - i - 1])])
		pre = [0 for i in range(2 * k + 10)]
		for (f, s) in vec:
			l = f + 1
			r = s + k
			pre[l] += 1
			pre[r + 1] -= 1
		sum = 0
		for i in range(0, 2 * k + 10):
			sum += pre[i]
			pre[i] = sum
		ans = n
		for x in range(2, 2 * k + 1):
			cnt0 = mp.get(x)
			if cnt0 == None:
				cnt0 = 0
			cnt1 = pre[x] - cnt0
			cnt2 = n / 2 - cnt0 - cnt1
			ans = min(ans, cnt1 + 2 * cnt2)
		print(int(ans))
		t -= 1
main()


test = int(input())
for t in range(test):
	n = int(input())
	a = []
	if n % 4:
		print('NO')
	else:
		print('YES')
		i = 2
		while i <= n:
			print(i, '', end='')
			i += 2
		j = 1
		count = 1
		while count < n / 2:
			print(j, '', end='')
			j += 2
			count += 1
		print(int(j + n / 2))


from math import factorial as fac
from collections import defaultdict
from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
sys.setrecursionlimit(10 ** 6)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
from collections import deque, defaultdict
import heapq

def bfs(V, E):
	s = set()
	print('\n'.join(map(str, E.items())))
	cnt = 0
	for v in V:
		if v in s:
			continue
		q = deque([])
		s.add(v)
		q.append(v)
		while len(q) > 0:
			x = q.popleft()
			for e in E[x]:
				if e not in s:
					s.add(e)
					q.append(e)
			print(q)
		cnt += 1
	return cnt

def regular_bs(L, x, l=None, r=None):
	l = 0 if l == None else l
	r = len(L) if r == None else r
	while r - l > 1:
		m = (r + l) // 2
		l = m if L[m] <= x else l
		r = m if L[m] > x else r
	return l if L[l] == x else -1
from typing import List, Tuple

class TreeNode:

	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None

	def __repr__(self):
		return f'({self.val}, {self.left.__repr__()}, {self.right.__repr__()})'

def helper(preorder: List[int], index, max_value=2 ** 300) -> Tuple[TreeNode, int]:
	if index >= len(preorder) or preorder[index] >= max_value:
		return (None, index)
	root_val = preorder[index]
	next_index = index + 1
	node = TreeNode(preorder[index])
	(node.left, next_index) = helper(preorder, next_index, root_val)
	(node.right, next_index) = helper(preorder, next_index, max_value)
	return (node, next_index)

def solution(n):
	if n % 4:
		print('NO')
		return
	print('YES')
	for i in range(2, n // 2 + 1, 2):
		print(f'{i} {2 * n - i}', end=' ')
	for i in range(1, n // 2 - 1, 2):
		print(f'{i} {2 * n - i}', end=' ')
	print(f'{n // 2 - 1} {2 * n - n // 2 + 1}')

def main():
	T = read_int()
	for i in range(T):
		n = read_int()
		solution(n)
main()


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')

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

	def In():
		return map(int, input().split())
else:

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

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

def f(n):
	if n % 4 != 0:
		return 'NO'
	l = []
	st = 'YES\n'
	l = [i for i in range(2, n + 1, 2)] + [i for i in range(1, n + 1, 2)]
	l[-1] = 3 * (n >> 1) - 1
	return ''.join((st, ' '.join(map(str, l))))

def func():
	t = I()
	st = ''
	for _ in range(t):
		n = I()
		st = '\n'.join((st, f(n)))
	print(st.lstrip())
func()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = [int(j) for j in input().split()]
	count = [0 for i in range(2 * k + 2)]
	pre = [0 for i in range(2 * k + 2)]
	for j in range(int(n / 2)):
		count[a[j] + a[n - 1 - j]] += 1
		pre[min(a[j], a[n - 1 - j]) + 1] += 1
		pre[max(a[j], a[n - 1 - j]) + k + 1] -= 1
	for j in range(1, len(pre)):
		pre[j] += pre[j - 1]
	ans = float('inf')
	for j in range(2, 2 * k + 1):
		two = n / 2 - count[j] - pre[j]
		temp = count[j] + pre[j] + two * 2
		ans = min(ans, temp)
	print(int(ans))


for i in range(int(input())):
	n = int(input())
	a = []
	if n // 2 % 2 == 1:
		print('No')
	else:
		print('Yes')
		for e in range(n // 2):
			print(2 * (e + 1), end=' ')
		for h in range(n // 2):
			if h < n // 4:
				print(2 * (h + 1) - 1, end=' ')
			else:
				print(2 * (h + 1) + 1, end=' ')


for i in range(int(input())):
	n = int(input())
	if n & 1:
		print('NO')
	elif n // 2 & 1:
		print('NO')
	else:
		print('YES')
		sum_even = 0
		for i in range(2, n + 1, 2):
			print(i, end=' ')
			sum_even += i
		sum_odd = 0
		for i in range(1, n - 1, 2):
			print(i, end=' ')
			sum_odd += i
		print(sum_even - sum_odd)


import sys, bisect, random
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	K = [[0, 0] for i in range(2 * k + 2)]
	P = []
	for i in range(n // 2):
		K[A[i] + A[n - i - 1]][1] = K[A[i] + A[n - i - 1]][1] - 1
		K[min(A[i], A[n - i - 1]) + 1][0] = K[min(A[i], A[n - i - 1]) + 1][0] - 1
		K[max(A[i], A[n - i - 1]) + k + 1][0] = K[max(A[i], A[n - i - 1]) + k + 1][0] + 1
		K[0][0] = K[0][0] + 2
	for i in range(1, len(K)):
		K[i][0] = K[i][0] + K[i - 1][0]
	for i in range(1, len(K) - 1):
		P.append([K[i][0] + K[i][1], i])
	v = min(P)
	print(v[0])


def pal(n, k, a):
	zeros = [0 for i in range(2 * k + 1)]
	ones_prefix = [0 for i in range(2 * k + 2)]
	for i in range(n // 2):
		(f, b) = (a[i], a[n - i - 1])
		ones_prefix[min(f + 1, b + 1)] += 1
		ones_prefix[max(f + k + 1, b + k + 1)] += -1
		zeros[f + b] += 1
	ones = [0 for i in range(2 * k + 2)]
	cs = 0
	for i in range(2 * k + 2):
		cs += ones_prefix[i]
		ones[i] = cs
	best = 2 * n
	for i in range(2, 2 * k + 1):
		zero = zeros[i]
		one = ones[i] - zero
		two = n // 2 - zero - one
		changes = one + 2 * two
		if changes < best:
			best = changes
	print(best)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pal(n, k, a)