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

You are given three integers $n$, $a$ and $b$, where $n$ is an even number. Print any permutation of length $n$ that the minimum among all its elements of the left half equals $a$ and the maximum among all its elements of the right half equals $b$. Print -1 if no such permutation exists.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 1000$), the number of test cases in the test. The following $t$ lines contain test case descriptions.

Each test case description contains three integers $n$, $a$, $b$ ($2 \le n \le 100$; $1 \le a,b \le n$; $a \ne b$), where $n$ is an even number (i.e. $n mod 2 = 0$).


-----Output-----

For each test case, print a single line containing any suitable permutation. Print -1 no such permutation exists. If there are multiple answers, print any of them.


-----Examples-----

Input
7
6 2 5
6 1 3
6 4 3
4 2 4
10 5 3
2 1 2
2 2 1
Output
4 2 6 5 3 1
-1
6 4 5 1 3 2 
3 2 4 1 
-1
1 2 
2 1


-----Note-----

None

Difficulty: EASY
Tags: Greedy algorithms

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import itertools
from math import floor, log, log2, ceil
from itertools import groupby
import sys
t = int(input())
res = []
for i in range(t):
	[n, a, b] = list(map(int, input().split()))
	half_len = n // 2
	arr_a = []
	arr_b = []
	len_a = -1
	len_b = -1
	if a < b:
		arr_a = [a] + list(range(b + 1, n + 1))
		len_a = n - b + 1
		arr_b = [b] + list(range(1, a))
		len_b = a
		if len_a <= half_len and len_b <= half_len:
			arr_a += list(range(a + 1, half_len - len_a + a + 1))
			arr_b += list(range(half_len - len_a + a + 1, b))
		else:
			len_a = -1
			len_b = -1
	elif a == half_len + 1 and b == half_len:
		len_b = half_len
		len_a = half_len
		arr_b += list(range(1, b + 1))
		arr_a += list(range(a, n + 1))
	if len_a == -1 and len_b == -1:
		res.append(-1)
	else:
		res.append(' '.join(map(str, arr_a + arr_b)))
for i in range(t):
	print(res[i])


def next():
	return input()

def nextInt():
	return int(next())

def nextFloat():
	return float(next())

def getIntArray(n, sep=' '):
	return [[int(d) for d in next().split(sep)] for _ in range(n)]

def getFloatArray(n):
	return [nextFloat() for _ in range(n)]

def getStringArray(n):
	return [next() for _ in range(n)]

def printList(l):
	print(' '.join(map(str, l)))
N = nextInt()
data = getIntArray(N)
for (s, l, r) in data:
	if l - 1 + (r > l) > s / 2 or r - (l < r) < s / 2:
		print('-1')
	else:
		if r >= s / 2 + 1:
			ap = list(range(s // 2 + 1, s + 1))
			ap.remove(r)
		else:
			ap = list(range(s // 2 + 2, s + 1))
		o = [l] + ap
		if l <= s / 2:
			ap = list(range(1, s // 2 + 1))
			ap.remove(l)
		else:
			ap = list(range(1, s // 2))
		o += [r] + ap
		printList(o)


_ = int(input())
for __ in range(_):
	(n, a, b) = map(int, input().split())
	out = [x for x in range(n, 0, -1)]
	pos_a = out.index(a)
	nn = n // 2
	if pos_a > nn - 1:
		(out[nn - 1], out[pos_a]) = (out[pos_a], out[nn - 1])
	pos_b = out.index(b)
	if pos_b < nn:
		(out[nn], out[pos_b]) = (out[pos_b], out[nn])
	if min(out[0:nn]) == a and max(out[nn:n]) == b:
		print(' '.join([str(x) for x in out]))
	else:
		print(-1)


import sys
for _ in range(int(sys.stdin.readline())):
	(n, a, b) = [int(x) for x in sys.stdin.readline().split()]
	left = [a]
	right = [b]
	arr = list(range(1, n + 1))
	arr.remove(a)
	arr.remove(b)
	left = left + arr[len(arr):len(arr) // 2 - 1:-1]
	right = right + arr[:len(arr) // 2]
	if min(left) != a or max(right) != b:
		print(-1)
	else:
		print(' '.join(map(str, left + right)))


def solve():
	(n, a, b) = map(int, input().split())
	(x, y, z) = ([], [], [])
	for i in range(1, n + 1):
		if i == a or i > b:
			if i < a:
				print(-1)
				return
			x.append(i)
		elif i == b or i < a:
			if i > b:
				print(-1)
				return
			y.append(i)
		else:
			z.append(i)
	if len(x) > n // 2 or len(y) > n // 2:
		print(-1)
		return
	print(' '.join(map(str, x + z + y)))
t = int(input())
for i in range(t):
	solve()


def special_permutation(n, a, b):
	h = n // 2
	mandatory_b_set = set(range(1, a))
	mandatory_a_set = set(range(b + 1, n + 1))
	if b not in mandatory_b_set:
		mandatory_b_set.add(b)
	if a not in mandatory_a_set:
		mandatory_a_set.add(a)
	if len(mandatory_a_set) > h or len(mandatory_b_set) > h:
		print(-1)
		return
	remaining = list(set(range(1, n + 1)) - mandatory_b_set - mandatory_a_set)
	permutation = list(mandatory_a_set) + remaining[:h - len(mandatory_a_set)] + list(mandatory_b_set) + remaining[h - len(mandatory_a_set):]
	print(' '.join(map(str, permutation)))
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	special_permutation(n, a, b)


NO_ANSWER = '-1'

def create_ans(arr):
	return ' '.join(map(str, arr))

def swapPositions(list, pos1, pos2):
	(list[pos1], list[pos2]) = (list[pos2], list[pos1])
	return list

def solve(n, a, b):
	arr = list(reversed(list(range(1, n + 1))))
	k = int(n / 2)
	if a >= k + 1 or b <= k:
		if a == k + 1 and b == k:
			return create_ans(arr)
		return NO_ANSWER
	if k - 1 == n - b or k == n - a:
		swapPositions(arr, n - b, n - a)
		return create_ans(arr)
	swapPositions(arr, k, n - b)
	swapPositions(arr, k - 1, n - a)
	return create_ans(arr)
t = input()
for _ in range(int(t)):
	s = input()
	(n, a, b) = map(int, s.split(' '))
	print(solve(n, a, b))


import itertools

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

def solve_one():
	(n, a, b) = [int(x) for x in input().split()]
	half_n = n // 2
	if not (a <= half_n + 1 and b >= half_n):
		print(-1)
		return
	if a == half_n + 1:
		if b != half_n:
			print(-1)
			return
		else:
			print(' '.join((str(x) for x in [*range(a, n + 1), *range(1, b + 1)])))
			return
	if b == half_n:
		if a != half_n + 1:
			print(-1)
			return
	left = [a, *range(b + 1, n + 1)]
	right = [b, *range(1, a)]
	mid = [*range(a + 1, b)]
	print(' '.join((str(x) for x in itertools.chain(left, mid, right))))
solve()


t = int(input())
for j in range(t):
	(n, a, b) = list(map(int, input().split()))
	(s, ans) = ([int(q) for q in range(1, n + 1)], [])
	ans.append(s.pop(s.index(a)))
	last = s.pop(s.index(b))
	s.sort(reverse=True)
	ans.extend(s)
	ans.append(last)
	print(' '.join([str(i) for i in ans])) if min(ans[:n // 2]) == a and max(ans[n // 2:]) == b else print(-1)


t = int(input())

def replace():
	(n, a, b) = map(int, input().split())
	string = str()
	if a >= n / 2 + 2:
		print('-1')
	elif b <= n / 2 - 1:
		print('-1')
	elif a > n / 2 and b > n / 2:
		print('-1')
	elif a <= n / 2 and b <= n / 2:
		print('-1')
	else:
		if a > n / 2:
			string += str(a) + ' '
			for i in range(int(n / 2), n):
				if i + 1 != a:
					string += str(i + 1) + ' '
			string += str(b) + ' '
			for i in range(int(n / 2)):
				if i + 1 != b:
					string += str(i + 1) + ' '
		else:
			string += str(a) + ' '
			for i in range(int(n / 2), n):
				if i + 1 != b:
					string += str(i + 1) + ' '
			string += str(b) + ' '
			for i in range(int(n / 2)):
				if i + 1 != a:
					string += str(i + 1) + ' '
		print(string)
for i in range(t):
	replace()


from itertools import chain
t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	if b < n // 2 or a > n // 2 + 1:
		print(-1)
		continue
	A = [a] + list(range(max(a + 1, b + 1), n + 1))
	B = [b] + list(range(1, min(a, b)))
	if len(A) > n // 2 or len(B) > n // 2:
		print(-1)
		continue
	m = len(A)
	A += list(range(b - n // 2 + m, b))
	B += list(range(a + 1, b - n // 2 + m))
	print(' '.join(map(str, chain(A, B))))


def permutation():
	n = int(input())
	for _ in range(n):
		line = input()
		(n, a, b) = line.split(' ')
		n = int(n)
		a = int(a)
		b = int(b)
		c = 0
		if a < b:
			c = 1
		if n - a + 1 - c >= n / 2 and b - c >= n / 2:
			left = [a]
			x = n
			while len(left) < n / 2:
				if x != b and x != a:
					left.append(x)
				x -= 1
			right = [b]
			y = 1
			while len(right) < n / 2:
				if y != b and y != a:
					right.append(y)
				y += 1
			perm = left + right
			string_perm = [str(p) for p in perm]
			res = ' '.join(string_perm)
			print(res)
		else:
			print(-1)
permutation()


def num1(n, a, b):
	res = [a] + [x for x in range(1, n + 1) if x not in [a, b]][::-1] + [b]
	if res[n // 2 - 1] < a or res[n // 2] > b:
		res = [-1]
	return ' '.join(map(str, res))
t = int(input())
for i in range(t):
	print(num1(*map(int, input().split())))


def solve():
	(n, mini, maxi) = map(int, input().split())
	l = []
	for i in range(n, 0, -1):
		if i == mini or i == maxi:
			continue
		else:
			l.append(i)
	l.insert(0, mini)
	l.append(maxi)
	ok = True
	for i in range(int(n / 2)):
		if l[i] < mini:
			ok = False
	for i in range(int(n / 2), n):
		if l[i] > maxi:
			ok = False
	if not ok:
		print(-1)
	else:
		print(' '.join(map(str, l)))
n = int(input())
for _ in range(n):
	solve()


from sys import stdin
input = stdin.readline
for t in range(int(input())):
	(n, a, b) = map(int, input().split())
	half = n // 2
	if a - 1 > half or n - b > half:
		print(-1)
		continue
	if a - 1 == half and b > half:
		print(-1)
		continue
	if b + 1 == half and a < half:
		print(-1)
		continue
	(b_arr, total) = ([], 0)
	for i in range(1, b):
		if i != a and total < half - 1:
			b_arr.append(i)
			total += 1
	(a_arr, total) = ([], 0)
	for i in range(n, a, -1):
		if i != b and total < half - 1:
			a_arr.append(i)
			total += 1
	if len(a_arr) != half - 1 or len(b_arr) != half - 1:
		print(-1)
		continue
	result = [str(a)]
	for r in a_arr:
		result.append(str(r))
	for r in b_arr:
		result.append(str(r))
	result.append(str(b))
	print(' '.join(result))


def proc(n, a, b):
	(left_ans, right_ans) = ([a], [b])
	taken = [0] * (n + 1)
	l_idx = n
	r_idx = 1
	taken[a] = 1
	taken[b] = 1
	for _ in range(n // 2 - 1):
		while l_idx >= a and taken[l_idx]:
			l_idx -= 1
		if l_idx >= a:
			left_ans.append(l_idx)
			taken[l_idx] = 1
			l_idx -= 1
		else:
			return -1
		while r_idx <= b and taken[r_idx]:
			r_idx += 1
		if r_idx <= b:
			right_ans.append(r_idx)
			taken[r_idx] = 1
			r_idx += 1
		else:
			return -1
	return ' '.join(map(str, left_ans + right_ans))
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	print(proc(n, a, b))


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	s = list((i for i in range(1, n + 1) if i != a and i != b))[::-1]
	if n == 2:
		print('1 2' if a == 1 else '2 1')
	else:
		print(str(a) + ' ' + ' '.join((str(i) for i in s)) + ' ' + str(b) if min(s[:(n - 2) // 2]) > a and max(s[(n - 2) // 2:]) < b else '-1')


num_cases = int(input())
for i in range(num_cases):
	(n, a, b) = list(map(int, input().split()))
	punto_medio = (n + 1) / 2
	if a < punto_medio and b < punto_medio or (a > punto_medio and b > punto_medio):
		print('-1')
	elif a > n / 2 + 1 or b < n / 2:
		print('-1')
	else:
		numbers_list = list(range(1, n + 1))
		if a == n / 2 + 1 and b == n / 2:
			mitad_left = numbers_list[int(n / 2):]
			mitad_right = numbers_list[:int(n / 2)]
			result_list = mitad_left + mitad_right
			print(' '.join(map(str, result_list)))
		else:
			numbers_list[a - 1] = b
			numbers_list[b - 1] = a
			mitad_left = numbers_list[int(n / 2):]
			mitad_right = numbers_list[:int(n / 2)]
			result_list = mitad_left + mitad_right
			print(' '.join(map(str, result_list)))


for inn in range(int(input())):
	(n, a, b) = map(int, input().split())
	answer = list(range(n, 0, -1))
	answer.remove(a)
	answer.remove(b)
	answer.insert(0, a)
	answer.append(b)
	if min(answer[:n // 2]) == a and max(answer[n // 2:]) == b:
		print(' '.join(map(str, answer)))
	else:
		print(-1)


def doTask():
	(n, a, b) = [int(a) for a in input().split(' ')]
	center = n // 2
	if a > center + 1 or b < center or (a <= center and b <= center) or (a > center and b > center) or (a == b):
		print(-1)
		return
	result = [a]
	for i in range(n, 0, -1):
		if i == a or i == b:
			continue
		result.append(i)
	result.append(b)
	print(' '.join([str(r) for r in result]))
for _ in range(int(input())):
	doTask()


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	ans = []
	aft = int((n + 2) / 2)
	for i in range(aft, n + 1):
		inpu = str(i)
		ans.append(inpu)
	for i in range(1, aft):
		inpu = str(i)
		ans.append(inpu)
	if b > n // 2 and a <= n // 2:
		ans.remove(str(a))
		ans.remove(str(b))
		ans.insert(0, str(a))
		ans.append(str(b))
		print(' '.join(ans))
	elif b == n // 2 and a == aft:
		print(' '.join(ans))
	else:
		print('-1')


in_data = []
num = input()
for i in range(int(num)):
	in_data.append([int(e) for e in input().split(' ')])
for i in range(int(num)):
	result = [e for e in range(1, in_data[i][0] + 1) if e != in_data[i][2] and e != in_data[i][1]]
	result.reverse()
	result.append(in_data[i][2])
	result = [in_data[i][1]] + result
	if in_data[i][1] == min(result[0:in_data[i][0] // 2]) and in_data[i][2] == max(result[in_data[i][0] // 2:in_data[i][0]]):
		print(' '.join([str(e) for e in result]))
	else:
		print(-1)


def p(l):
	s = ''
	for i in range(len(l)):
		s = s + str(l[i]) + ' '
	print(s)

def f(n, a, b):
	if a > n // 2 or b < n // 2 + 1 or a > b:
		if a != b + 1:
			print(-1)
		elif b != n // 2:
			print(-1)
		else:
			l1 = [i for i in range(a, n + 1)]
			l2 = [j for j in range(1, b + 1)]
			l1.extend(l2)
			p(l1)
	else:
		l1 = [i for i in range(b + 1, n + 1)]
		l2 = [j for j in range(1, a)]
		l1.append(a)
		l2.append(b)
		l3 = [i for i in range(a + 1, a + 1 + n // 2 - len(l1))]
		l1.extend(l3)
		if b - l1[-1] - 1 != n // 2 - len(l2):
			print(-1)
		else:
			l4 = [j for j in range(l1[-1] + 1, b)]
		l1.extend(l2)
		l1.extend(l4)
		p(l1)
x = int(input())
m = []
for i in range(x):
	y = input()
	y1 = y.split(' ')
	y2 = [int(t) for t in y1]
	m.append(y2)
for j in range(x):
	f(m[j][0], m[j][1], m[j][2])


t = int(input())
import math
for _ in range(t):
	(n, a, b) = tuple(map(int, input().split()))
	flag = [0 for _ in range(n + 1)]
	res = []
	res.append(a)
	flag[a] = 1
	flag[b] = 1
	for i in range(n, a, -1):
		if len(res) == n // 2:
			break
		if i == b:
			continue
		flag[i] = 1
		res.append(i)
	if len(res) < n // 2:
		print(-1)
		continue
	res.append(b)
	for i in range(1, b):
		if flag[i] == 1:
			continue
		if i == a:
			continue
		res.append(i)
	if len(res) < n:
		print(-1)
		continue
	print(' '.join([str(i) for i in res]))


import math
k = int(input())
for i in range(0, k):
	(n, a, b) = list(map(int, input().split(' ')))
	z = [x for x in range(n, 0, -1)]
	z = list(filter(lambda x: x != a and x != b, z))
	z = [a] + z + [b]
	if min(z[:int(n / 2)]) == a and b == max(z[int(n / 2):]):
		print(' '.join(list(map(str, z[:]))))
	else:
		print('-1')


iteracja = int(input())

def solve():
	(n, a, b) = map(int, input().split())
	lewo = [a]
	prawo = []
	srodek = []
	lista = [element for element in range(1, n + 1)]
	for element in lista:
		if element == a or element == b:
			continue
		if element < b and element < a:
			prawo.append(element)
		elif element > a and element > b:
			lewo.append(element)
		else:
			srodek.append(element)
	prawo.append(b)
	wynik = lewo[:]
	for element in srodek:
		wynik.append(element)
	for element in prawo:
		wynik.append(element)
	if min(wynik[:len(wynik) // 2]) != a or max(wynik[len(wynik) // 2:]) != b:
		print('-1')
		return
	print(' '.join(map(str, wynik)))
for element in range(iteracja):
	solve()


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	(v1, v2) = ([a], [b])
	for i in range(n, a, -1):
		if i != b and len(v1) < n // 2:
			v1.append(i)
	for i in range(1, b):
		if i != a and len(v2) < n // 2:
			v2.append(i)
	if len(v1) != n // 2 or len(v2) != n // 2:
		print(-1)
	else:
		print(' '.join(map(str, v1 + v2)))


from sys import stdin
count = int(stdin.readline())
for _ in range(count):
	(_len, a, b) = tuple(map(lambda x: int(x), stdin.readline().split()))
	first = {a}
	for i in range(_len, 0, -1):
		if len(first) == _len // 2:
			break
		if i != a and i != b:
			first.add(i)
	if min(first) != a:
		print('-1')
		continue
	second = {b}
	for i in range(1, _len + 1):
		if i not in first and i != b:
			second.add(i)
	if max(second) != b:
		print('-1')
		continue
	print(' '.join([str(i) for i in list(first) + list(second)]))


def find_list(n, a, b):
	smaller = [a]
	bigger = [b]
	for number in range(1, n + 1):
		if len(bigger) != n / 2 and number != b and (number != a):
			bigger.append(number)
		elif number != b and number != a:
			smaller.append(number)
	if max(bigger) == b and min(smaller) == a:
		return smaller + bigger
	else:
		return [-1]
t = int(input())
for e in range(t):
	(n, a, b) = list(map(int, input().split()))
	answer = find_list(n, a, b)
	print(' '.join(map(str, answer)))


import itertools
n = int(input())
for t in range(0, n):
	sol = '-1'
	(c, a, b) = tuple(map(int, input().split()))
	left = [a]
	right = [b]
	orig = list(range(1, c + 1))
	for x in orig[:a - 1]:
		if x != b:
			right.append(x)
	for y in orig[b:]:
		if y != a:
			left.append(y)
	middle = orig[a:b - 1]
	for e in middle:
		if len(left) < c / 2:
			left.append(e)
		elif len(right) < c / 2:
			right.append(e)
	if len(left) == c / 2 and len(right) == c / 2 and (min(left) == a) and (max(right) == b):
		v = ''
		for c in left:
			v += str(c) + ' '
		for c in right:
			v += str(c) + ' '
		print(v.strip())
	else:
		print('-1')


for _ in range(int(input())):
	(n, a, b) = [int(val) for val in input().split(' ')]
	halfSize = n // 2
	if n - b > halfSize - (0 if a > b else 1) or a - 1 > halfSize - (0 if b < a else 1) or a - b > 1:
		print('-1')
		continue
	firstHalf = [a]
	secondHalf = [b]
	later = []
	for x in range(1, n + 1):
		if x == a or x == b:
			continue
		if x > b:
			firstHalf.append(x)
		elif x < a:
			secondHalf.append(x)
		else:
			later.append(x)
	for x in later:
		if len(firstHalf) < n // 2:
			firstHalf.append(x)
		elif len(secondHalf) < n // 2:
			secondHalf.append(x)
	print(' '.join([str(i) for i in firstHalf + secondHalf]))


t = int(input())
for o in range(t):
	(n, a, b) = [int(x) for x in input().split()]
	ava = [x + 1 for x in range(n)]
	ava.remove(a)
	ava.remove(b)
	front = [a]
	front += ava[int(len(ava) / 2):]
	back = [b]
	back += ava[:int(len(ava) / 2)]
	if min(front) == a and max(back) == b:
		ret = front + back
		j = ''
		for x in ret:
			j += ' ' + str(x)
		print(j[1:])
	else:
		print(-1)


t = int(input().strip())
for i in range(t):
	(n, min, max) = tuple(map(int, input().strip().split()))
	if min > n // 2 + 1 or n - max > n // 2:
		print(-1)
		continue
	ans = ''
	if min > max:
		for i in range(min, n + 1):
			ans += str(i)
			ans += ' '
		for i in range(1, max + 1):
			ans += str(i)
			ans += ' '
		print(ans[:-1])
	else:
		count = 0
		for i in range(max + 1, n + 1):
			count += 1
			ans += str(i)
			ans += ' '
		if count >= n // 2:
			print(-1)
			continue
		for i in range(min, max + 1):
			count += 1
			ans += str(i)
			ans += ' '
		if count < n // 2 + 1:
			print(-1)
			continue
		for i in range(min - 1, 0, -1):
			ans += str(i)
			ans += ' '
		print(ans[:-1])


from sys import stdin, stdout
t = int(stdin.readline())
for tt in range(t):
	(n, a, b) = [int(s) for s in stdin.readline().split()]
	ar = [0 for i in range(n)]
	(ar[n // 2 - 1], ar[n - 1]) = (a, b)
	mx = n
	for i in range(n // 2 - 1):
		while mx == a or mx == b:
			mx -= 1
		ar[i] = mx
		mx -= 1
	for i in range(n // 2, n - 1):
		while mx == a or mx == b:
			mx -= 1
		ar[i] = mx
		mx -= 1
	if min(ar[:n // 2]) != a or max(ar[n // 2:]) != b:
		print(-1)
	else:
		print(' '.join([str(i) for i in ar]))


for i in range(int(input())):
	(n, a, b) = map(int, input().split())
	answer = []
	check = False
	count_1 = 0
	count_2 = 0
	for j in range(n, a, -1):
		if j != b:
			answer.append(j)
			count_1 += 1
		if count_1 >= n // 2 - 1:
			break
	if count_1 < n // 2 - 1:
		check = True
	answer.append(a)
	for j in range(1, b):
		if j != a:
			answer.append(j)
			count_2 += 1
		if count_2 >= n // 2 - 1:
			break
	if count_2 < n // 2 - 1:
		check = True
	answer.append(b)
	if check or a == b:
		print(-1)
	else:
		print(' '.join((str(x) for x in answer)))


get = lambda : list(map(int, input().split()))
t = get()[0]
li = [get() for i in range(t)]

def permutation(li: list):
	(n, a, b) = (li[0], li[1], li[2])
	lileft = [a]
	liright = [b]
	num = 0
	if b < n / 2 or (b <= n / 2 and a < b):
		return -1
	while True:
		num += 1
		if num < a and num < b and (len(liright) != n / 2):
			liright.append(num)
		elif num > a and num > b and (len(lileft) != n / 2):
			lileft.append(num)
		elif num > a and num < b and (len(liright) != n / 2):
			liright.append(num)
		elif num > a and num < b and (len(lileft) != n / 2):
			lileft.append(num)
		elif len(lileft) == n / 2 and len(liright) == n / 2:
			break
		elif num != a and num != b:
			return -1
	n = ''
	for i in lileft:
		n += str(i) + ' '
	for i in liright:
		n += str(i) + ' '
	return n[:-1]
for n in li:
	print(permutation(n))


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	left = [a]
	right = [b]
	for i in range(1, n + 1):
		if i == a or i == b:
			pass
		elif i < a and i < b:
			right.append(i)
		elif i > a and i < b:
			if len(right) < n / 2:
				right.append(i)
			elif len(left) < n / 2:
				left.append(i)
		elif i > a and i > b:
			left.append(i)
	if len(left) != n / 2 or len(right) != n / 2:
		print(-1)
	else:
		s = str(left + right)[1:-1].replace(',', '')
		print(s)


t = int(input())
for _ in range(t):
	(n, a, b) = list(map(int, input().split(' ')))
	if a > n // 2 + 1 - (b > a) or b < n // 2 + (a < b):
		print(-1)
		continue
	arr = list(range(n, 0, -1))
	arr.remove(a)
	arr.remove(b)
	arr.append(b)
	arr.insert(0, a)
	print(*arr)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	l1 = [int(a) for a in range(n, 0, -1)]
	ans = str(a) + ' '
	(t1, t2) = (n - a, b - 1)
	if b > a:
		t1 -= 1
		t2 -= 1
	if t1 >= n // 2 - 1 and t2 >= n // 2 - 1:
		for i in range(n // 2):
			if l1[i] != b and l1[i] != a:
				ans += str(l1[i]) + ' '
		ans += str(b) + ' '
		for i in range(n // 2, n):
			if l1[i] != a and l1[i] != b:
				ans += str(l1[i]) + ' '
		print(ans[:-1])
	else:
		print(-1)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	mid_n = n // 2
	c = b
	count = 1
	string = str(a)
	while n > a and count < mid_n:
		if n != b:
			count += 1
			string += ' ' + str(n)
		n -= 1
	if n == a:
		n -= 1
	if count == mid_n and b >= n:
		string += ' ' + str(b)
		for x in range(1, n + 1):
			if x != a and x != b:
				string += ' ' + str(x)
		print(string)
	else:
		print('-1')


def permut(n, a, b):
	k = int(n / 2)
	if a == n / 2 + 1 and b == n / 2:
		L = []
		for i in range(k + 1, n + 1):
			L.append(i)
		for i in range(1, k + 1):
			L.append(i)
		return L
	elif a >= n / 2 + 1 or b <= n / 2:
		return -1
	L = [a]
	for i in range(n, k, -1):
		if i != b:
			L.append(i)
	for j in range(1, k + 1):
		if j != a:
			L.append(j)
	L.append(b)
	return L
total = int(input())
for i in range(total):
	line = input().split()
	n = int(line[0])
	a = int(line[1])
	b = int(line[2])
	ans = permut(n, a, b)
	if ans == -1:
		print('-1')
	else:
		strans = ''
		for j in range(n - 1):
			strans += str(ans[j])
			strans += ' '
		strans += str(b)
		print(strans)


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split())
	p = []
	q = []
	for j in range(int(n / 2) + 1, n + 1):
		if j != a and j != b:
			p.append(j)
	p.append(a)
	q.append(b)
	for j in range(1, int(n / 2 + 1)):
		if j != b and j != a:
			q.append(j)
	if min(p) == a and max(q) == b and (len(p) == len(q)):
		s1 = ' '.join((str(o) for o in p))
		s2 = ' '.join((str(o) for o in q))
		print(s1 + ' ' + s2)
	else:
		print(-1)


for s in [*open(0)][1:]:
	(n, a, b) = map(int, s.split())
	(*r,) = range(n, 0, -1)
	if a <= n // 2 < b:
		(r[-a], r[-b]) = (r[-b], r[-a])
	elif (n // 2 == a - 1 == b) < 1:
		r = (-1,)
	print(*r)


t = int(input())
for _ in range(t):
	(n, a, b) = list(map(int, input().split()))
	mid = n // 2
	left = [a]
	right = [b]
	numbers = [i for i in range(1, n + 1) if i not in [a, b]]
	for number in numbers[::-1]:
		if len(left) < mid and number > a:
			left.append(number)
		elif len(right) < mid and number < b:
			right.append(number)
		else:
			print(-1)
			break
	else:
		answer = left + right
		print(' '.join(map(str, answer)))


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split())
	length = int(n / 2)
	x = [j for j in range(1, length + 1)]
	y = [k for k in range(n - length + 1, n + 1)]
	if x.count(a) and y.count(b):
		x[x.index(a)] = b
		y[y.index(b)] = a
		print(*y + x)
	elif (x.count(b) and x[-1] == b) and (y.count(a) and y[0] == a):
		print(*y + x)
	else:
		print(-1)


k = []
for i in range(int(input())):
	(n, a, b) = map(int, input().split())
	r = [b]
	[r.append(j) for j in range(1, n + 1) if j != a and j < b and (len(r) < n // 2)]
	l = [j for j in range(1, n + 1) if j not in r]
	if len(l) == len(r) and min(l) == a and (max(r) == b):
		x = l + r
		s = ' '.join((str(j) for j in x))
		k.append(s)
	else:
		k.append(-1)
for t in k:
	print(t)


import sys
input = sys.stdin.readline

def solve():
	(n, a, b) = map(int, input().split())
	if a < b:
		left = [a] + [i for i in range(b + 1, n + 1)]
		right = [j for j in range(1, a)] + [b]
		if len(left) > n // 2 or len(right) > n // 2:
			return [-1]
		ans = left + [i for i in range(a + 1, b)] + right
		return ans if len(ans) == n else [-1]
	else:
		right = [i for i in range(1, b + 1)]
		left = [j for j in range(a, n + 1)]
		if len(right) == len(left) == n // 2:
			return left + right
		else:
			return [-1]
for _ in range(int(input())):
	print(*solve())


T = int(input())
for _ in range(T):
	(n, a, b) = map(int, input().split())
	if 2 * a > n + 2 or 2 * b < n or (2 * a == n + 2 and 2 * b != n) or (2 * a != n + 2 and 2 * b == n):
		print('-1')
	else:
		print(a, end=' ')
		for i in range(n, 0, -1):
			if i != a and i != b:
				print(i, end=' ')
		print(b)


def specealpermution(n, left, right):
	arr = [left]
	for i in range(n, 0, -1):
		if i != left and i != right:
			arr.append(i)
	arr.append(right)
	if len(arr) == n and min(arr[0:n // 2]) == left and (max(arr[n // 2:n]) == right):
		print(*arr)
	else:
		print(-1)
testCase = int(input())
while testCase != 0:
	testCase -= 1
	(n, l, r) = map(int, input().split(' '))
	specealpermution(n, l, r)


def solve():
	(n, mn, mx) = list(map(int, input().split()))
	l = [i for i in range(1, n + 1) if i not in [mn, mx]][::-1]
	l.insert(0, mn)
	l.insert(n, mx)
	if min(l[:n // 2]) == mn and max(l[n // 2:]) == mx:
		print(*l)
	else:
		print(-1)
t = int(input())
for _ in range(t):
	solve()


def main():
	(n, a, b) = map(int, input().split())
	ls = list(range(b + 1, n + 1))
	if a not in ls:
		ls.append(a)
	rs = list(range(1, a))
	if b not in rs:
		rs.append(b)
	ih = list(range(a + 1, b))
	while ih and len(ls) < n >> 1:
		ls.append(ih.pop())
	rs.extend(ih)
	if len(ls) == len(rs) == n >> 1:
		print(*ls, *rs)
	else:
		print(-1)
for _ in range(int(input())):
	main()


x = int(input())
while x > 0:
	(a, b, c) = map(int, input().split())
	if b > a / 2 + 1 or c < a / 2:
		print(-1)
	elif b < a / 2 + 1 and c <= a / 2:
		print(-1)
	elif c > a / 2 and b > a / 2:
		print(-1)
	elif b == a / 2 + 1 and c == a / 2:
		ref = []
		for i in range(1, a + 1):
			ref.append(i)
		ref.reverse()
		print(*ref)
	else:
		ref = []
		for i in range(1, a + 1):
			ref.append(i)
		(ref[b - 1], ref[c - 1]) = (ref[c - 1], ref[b - 1])
		ref.reverse()
		print(*ref)
	x -= 1


def specialPerm(n, a, b):
	ans = []
	if a == n // 2 + 1 and b == n // 2:
		for i in range(n // 2):
			ans.append(a + i)
		for i in range(n // 2):
			ans.append(i + 1)
	elif a < b:
		if b > n // 2 and a < n // 2 + 1:
			ans.append(a)
			for i in range(n - b):
				ans.append(n - i)
			for i in range(b - a):
				ans.append(a + 1 + i)
			for i in range(a - 1):
				ans.append(i + 1)
		else:
			ans.append(-1)
	else:
		ans.append(-1)
	return ans
T = int(input())
for i in range(T):
	l = list(map(int, input().split()))
	print(*specialPerm(l[0], l[1], l[2]))


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split())
	k = n // 2
	if a < b:
		p = 1
	else:
		p = 0
	if a - 1 > k - p:
		print(-1)
	elif n - b > k - p:
		print(-1)
	else:
		q = [a]
		for i in range(b + 1, n + 1):
			if i != a:
				q.append(i)
		s = k - len(q)
		for i in range(a + 1, a + s + 1):
			q.append(i)
		q.append(b)
		for i in range(1, a):
			if i != b:
				q.append(i)
		for i in range(a + s + 1, b):
			q.append(i)
		print(*q)


import sys
import math
from fractions import Fraction
input = sys.stdin.readline
t = int(input())
while t > 0:
	inp = input().strip()
	s = [int(x) for x in inp.split(' ')]
	n = s[0]
	a = s[1]
	b = s[2]
	if a > int(n / 2) + 1 or b < int(n / 2):
		print('-1')
	elif a < b and (a == int(n / 2) + 1 or b == int(n / 2)):
		print('-1')
	else:
		ans = [0] * n
		ans[0] = a
		p = 1
		c = n
		while p < int(n / 2):
			if c == b or c == a:
				c -= 1
				continue
			ans[p] = c
			c -= 1
			p += 1
		ans[p] = b
		p += 1
		while p < n:
			if c == a or c == b:
				c -= 1
				continue
			ans[p] = c
			c -= 1
			p += 1
		print(' '.join([str(x) for x in ans]))
	t -= 1


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	arr = [a]
	for i in range(n, 0, -1):
		if i != a and i != b:
			arr.append(i)
	arr.append(b)
	if a < b:
		if a <= n // 2 and b >= n // 2 + 1:
			print(*arr)
		else:
			print(-1)
	elif a <= n // 2 + 1 and b >= n // 2:
		print(*arr)
	else:
		print(-1)


def perm(length, l_min, r_max):
	nums_less_than_l_min = list(range(1, l_min))
	nums_greater_than_r_max = list(range(r_max + 1, length + 1))
	nums_in_between = list(range(l_min + 1, r_max))
	if l_min > r_max:
		nums_less_than_l_min.remove(r_max)
		nums_greater_than_r_max.remove(l_min)
		nums_in_between = list(range(r_max + 1, l_min))
	if len(nums_less_than_l_min) > length // 2 - 1 or len(nums_greater_than_r_max) > length // 2 - 1:
		return [-1]
	permutation = [l_min] + nums_greater_than_r_max + nums_in_between + nums_less_than_l_min + [r_max]
	return permutation
test_cases = int(input())
ans_array = []
for i in range(test_cases):
	(n, a, b) = input().split()
	temp = perm(int(n), int(a), int(b))
	ans_array.append(temp)
for i in range(test_cases):
	print(*ans_array[i])


class Solution:

	def permutation(self, n, a, b):
		ans = []
		ans.append(a)
		for i in range(n, 0, -1):
			if i != a and i != b:
				ans.append(i)
		ans.append(b)
		if len(ans) == n:
			if min(ans[:n // 2]) == a and max(ans[n // 2:n]) == b:
				print(*ans)
				return ans
		print(-1)
obj = Solution()
t = int(input())
for _ in range(t):
	(n, a, b) = list(map(int, input().split()))
	obj.permutation(n, a, b)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	lst = []
	if b < n // 2 or a > n // 2 + 1:
		print(-1)
	elif b == n // 2 and a != n // 2 + 1:
		print(-1)
	elif a == n // 2 + 1 and b != n // 2:
		print(-1)
	else:
		lst.append(a)
		for i in range(n, 0, -1):
			if i == a:
				continue
			elif i == b:
				continue
			else:
				lst.append(i)
		lst.append(b)
		print(*lst)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	if a == n // 2 + 1 and b == n // 2:
		ans = [i + 1 for i in range(n)][::-1]
		print(*ans)
		continue
	elif a >= n // 2 + 1 or b <= n // 2:
		print(-1)
		continue
	(aa, bb) = ([a], [b])
	for i in range(b + 1, n + 1):
		aa.append(i)
	for i in range(1, a):
		bb.append(i)
	i = a + 1
	while len(aa) != n // 2:
		aa.append(i)
		i += 1
	while len(bb) != n // 2:
		bb.append(i)
		i += 1
	aa.extend(bb)
	print(*aa)


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())

	def solve(n, a, b):
		arr = [i for i in range(n, 0, -1)]
		if a <= n // 2 and b > n // 2:
			(arr[-a], arr[-b]) = (arr[-b], arr[-a])
		elif (n // 2 == a - 1 == b) < 1:
			return [-1]
		return arr
	print(*solve(n, a, b))


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split())
	p = [a]
	for j in range(n, 0, -1):
		if j != a and j != b:
			p.append(j)
	p.append(b)
	if len(p) == n and min(p[0:n // 2]) == a and (max(p[n // 2:n]) == b):
		print(*p)
	else:
		print(-1)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	p = list(range(1, n + 1))
	p.remove(a)
	p.remove(b)
	r = []
	r.append(a)
	r += p[(n - 1) // 2:]
	r.append(b)
	r += p[:(n - 1) // 2]
	if min(r[:n // 2]) == a and max(r[n // 2:]) == b:
		print(*r)
	else:
		print(-1)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	if a > n // 2 + 1 - (b > n // 2 + 1) or b < n // 2 + (a < n // 2):
		print(-1)
	else:
		w = list(set(range(1, n + 1)) - {a} - {b})
		w = w[(n - 2) // 2:] + [a] + w[:(n - 2) // 2] + [b]
		print(*w)


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

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

def si():
	return str(input())

def ni():
	return int(input())

def find(x, m):
	count = 0
	while x % m == 0:
		count += 1
		x //= m
	return (x, m ** count)

def check(a, m):
	new = [[0, 0]]
	for i in a:
		temp = find(i, m)
		if new[-1][0] != temp[0]:
			new.append([temp[0], 0])
		new[-1][1] += temp[1]
	return new
for t in range(int(input())):
	(n, a, b) = mi()
	ans = list(range(n // 2 + 1, n + 1)) + list(range(1, n // 2 + 1))
	mid = n // 2
	if a == mid + 1 and b == mid:
		print(*ans)
		continue
	if a > mid or b <= mid:
		print(-1)
	else:
		x = ans.index(a)
		y = ans.index(b)
		(ans[x], ans[y]) = (ans[y], ans[x])
		print(*ans)


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split(' '))
	A = []
	B = [b]
	for i in range(1, n + 1):
		if len(B) == int(n / 2):
			break
		elif i >= b:
			break
		elif i != a:
			B.append(i)
	for i in range(1, n + 1):
		if i not in B:
			A.append(i)
	if len(A) == int(n / 2) and len(B) == int(n / 2) and (min(A) == a) and (max(B) == b):
		print(' '.join((str(i) for i in A + B)))
	else:
		print('-1')


import math
T = int(input())
while T:
	T -= 1
	(n, a, b) = map(int, input().split())
	r = list(range(1, a))
	l = list(range(n, b, -1))
	if b not in r:
		r.append(b)
	if a not in l:
		l.append(a)
	if len(r) > n // 2 or len(l) > n // 2:
		print(-1)
	else:
		temp = (l, list(range(a + 1, b)), r)
		for i in temp:
			for j in i:
				print(j, end=' ')
		print()


for i in range(int(input())):
	(n, a, b) = map(int, input().split())
	ans = True
	if a - b <= 1:
		l = [a]
		for i in range(b + 1, n + 1):
			if i > a:
				if len(l) >= n // 2:
					break
				l.append(i)
		if len(l) < n // 2:
			for i in range(n // 2 - len(l)):
				if b - i - 1 <= 0 or b - i - 1 <= a:
					ans = False
					break
				l.append(b - i - 1)
		s = set(list(range(1, n + 1)))
		s2 = set(l)
		l2 = list(s - s2)
		if min(l) < a or max(l2) > b:
			ans = False
	else:
		ans = False
	if ans:
		print(*l + l2)
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, a, b) = map(int, input().split(' '))
	r = n // 2
	arr = []
	if b > a:
		if r >= a and b >= r + 1:
			arr.append(a)
			for theta in range(b + 1, n + 1):
				arr.append(theta)
			for kappa in range(a + 1, a + b - r):
				arr.append(kappa)
			for beta in range(1, a):
				arr.append(beta)
			for delta in range(a + b - r, b + 1):
				arr.append(delta)
			print(*arr)
		else:
			print(-1)
	elif a == r + 1 and b == r:
		for gamma in range(r + 1, n + 1):
			arr.append(gamma)
		for alpha in range(1, r + 1):
			arr.append(alpha)
		print(*arr)
	else:
		print(-1)


n = int(input())
for i in range(n):
	(n, a, b) = map(int, input().split())
	if a > (n + 2) / 2 or b < n / 2 or (b <= n / 2 and a < b) or (a >= (n + 2) / 2 and a < b):
		print(-1)
		continue
	print(a, end=' ')
	for j in range(n, 0, -1):
		if j != a and j != b:
			print(j, end=' ')
	print(b)


import math
t = int(input())
for x in range(t):
	a11 = input().split()
	n = int(a11[0])
	a = int(a11[1])
	b = int(a11[2])
	k = int(n / 2)
	if a >= k + 2 or b <= k - 1:
		print(-1)
	else:
		aaa = [x1 for x1 in range(1, k + 1)]
		bbb = [x2 for x2 in range(k + 1, 2 * k + 1)]
		if a == k + 1:
			if b == k:
				ccc = bbb + aaa
				print(*ccc)
			else:
				print(-1)
		elif b == k:
			if a == k + 1:
				ccc = bbb + aaa
				print(*ccc)
			else:
				print(-1)
		else:
			aaa += [b]
			bbb += [a]
			bbb.remove(b)
			aaa.remove(a)
			if len(bbb) != k or len(aaa) != k:
				print(-1)
			else:
				ccc = bbb + aaa
				print(*ccc)


for _ in range(int(input())):
	(n, a, b) = input().split()
	n = int(n)
	a = int(a)
	b = int(b)
	x = [i for i in range(1, n + 1)]
	if a <= n // 2 and b <= n // 2 or (a > n // 2 and b > n // 2) or a > n // 2 + 1 or (b < n // 2):
		print(-1)
		continue
	if n != b:
		(x[a - 1], x[-1]) = (x[-1], x[a - 1])
		(x[b - 1], x[0]) = (x[0], x[b - 1])
	else:
		(x[a - 1], x[-1]) = (x[-1], x[a - 1])
		(x[a - 1], x[0]) = (x[0], x[a - 1])
	x.reverse()
	if x[0] == min(x[:n // 2]) and x[-1] == max(x[n // 2:]):
		print(*x)
		continue
	elif n > 3:
		c = x.index(min(x[1:n // 2]))
		d = x.index(max(x[n // 2:n - 1]))
		(x[c], x[d]) = (x[d], x[c])
		print(*x)


def sptfn(n, a, b):
	ctr = max(a - 1, n - b)
	if ctr > n // 2 - int(a - 1 < n // 2 or b > n // 2):
		return [-1]
	(out, x, y) = (list(range(1, n + 1)), 0, n - 1)
	while ctr:
		if out[x] == a:
			x += 1
		if out[y] == b:
			y -= 1
		(out[x], out[y]) = (out[y], out[x])
		x += 1
		y -= 1
		ctr -= 1
	return out
for i in range(int(input())):
	print(*sptfn(*map(int, input().split())), sep=' ')


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	l1 = [a]
	l2 = [b]
	ex = []
	flag = True
	for i in range(1, n + 1):
		if i == a or i == b:
			continue
		elif i < b and i > a:
			ex.append(i)
		elif i < b and i < a:
			l2.append(i)
		elif i > b and i > a:
			l1.append(i)
		elif i > b and i < a:
			flag = False
			break
	if flag == False or len(l1) > n / 2 or len(l2) > n / 2:
		print(-1)
	else:
		print(*l1, *ex, *l2)


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	p = n // 2
	s = (n - 2) // 2
	c = (n + 1) / 2
	ans = []
	arr1 = []
	arr2 = []
	arr = [i for i in range(1, n + 1)]
	mx = max(arr)
	mn = min(arr)
	if n > 2 and (a > c and b > c or (a < c and b < c) or a == mx or (b == mn)):
		print(-1)
	else:
		arr.remove(a)
		arr.remove(b)
		arr1 = arr[s:]
		arr2 = arr[:s]
		for it in arr1:
			if it < a:
				arr1.remove(it)
		for it in arr2:
			if it > b:
				arr2.remove(it)
		ans = [a] + arr1 + [b] + arr2
		if len(ans) == n:
			print(*ans)
		else:
			print(-1)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	(l, r) = ([i for i in range(b + 1, n + 1)], [i for i in range(1, a)])
	if a not in l:
		l.append(a)
	if b not in r:
		r.append(b)
	if len(l) > n // 2 or len(r) > n // 2:
		print(-1)
		continue
	ans = l + [i for i in range(a + 1, b)] + r
	print(*ans)


for i in range(int(input())):
	(n, a, b) = list(map(int, input().split(' ')))
	z = [x for x in range(n, 0, -1)]
	z = list(filter(lambda x: x != a and x != b, z))
	z = [a] + z + [b]
	if min(z[:int(n / 2)]) == a and b == max(z[int(n / 2):]):
		print(*z)
	else:
		print('-1')


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	ans = [i for i in range(n, 0, -1)]
	if a < b:
		for i in range(n):
			if ans[i] == b:
				ans[i] = a
			elif ans[i] == a:
				ans[i] = b
	if min(ans[:n // 2]) == a and max(ans[n // 2:]) == b:
		print(*ans)
	else:
		print(-1)


tst = int(input())
for i in range(tst):
	(n, a, b) = map(int, input().split())
	c = [a]
	for i in range(n, 0, -1):
		if i != a and i != b:
			c.append(i)
	c.append(b)
	if len(c) == n and min(c[0:n // 2]) == a and (max(c[n // 2:n]) == b):
		print(*c)
	else:
		print(-1)


for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	w = [i for i in range(n, 0, -1)]
	del w[w.index(a)]
	del w[w.index(b)]
	c = [a] + w + [b]
	if max(c[n // 2:]) == b and min(c[:n // 2]) == a:
		for i in range(len(c)):
			print(c[i], end=' ')
		print('\n')
	else:
		print(-1)


def solve():
	(n, a, b) = list(map(int, input().split()))
	(left, right) = (set(), set())
	left.add(a)
	right.add(b)
	for num in range(a - 1, 0, -1):
		right.add(num)
	for num in range(b + 1, n + 1):
		left.add(num)
	if len(left) > n // 2 or len(right) > n // 2:
		return [-1]
	(leftSize, rightSize) = (len(left), len(right))
	for num in range(min(a, b) + 1, max(a, b)):
		if leftSize < n // 2:
			left.add(num)
			leftSize += 1
		else:
			right.add(num)
			rightSize += 1
	return [num for num in left] + [num for num in right]
for i in range(int(input())):
	print(*solve())