After a long and successful day of preparing food for the banquet, it is time to clean up. There is a list of n jobs to do before the kitchen can be closed for the night. These jobs are indexed from 1 to n.

Most of the cooks have already left and only the Chef and his assistant are left to clean up. Thankfully, some of the cooks took care of some of the jobs before they left so only a subset of the n jobs remain. The Chef and his assistant divide up the remaining jobs in the following manner. The Chef takes the unfinished job with least index, the assistant takes the unfinished job with the second least index, the Chef takes the unfinished job with the third least index, etc. That is, if the unfinished jobs were listed in increasing order of their index then the Chef would take every other one starting with the first job in the list and the assistant would take every other one starting with the second job on in the list.

The cooks logged which jobs they finished before they left. Unfortunately, these jobs were not recorded in any particular order. Given an unsorted list
of finished jobs, you are to determine which jobs the Chef must complete and which jobs his assitant must complete before closing the kitchen for the 
evening.

-----Input-----

The first line contains a single integer T ≤ 50 indicating the number of test cases to follow. Each test case consists of two lines. The first line contains two numbers n,m satisfying 0 ≤ m ≤ n ≤ 1000. Here, n is the total number of jobs that must be completed before closing and m is the number of jobs that have already been completed. The second line contains a list of m distinct integers between 1 and n. These are the indices of the jobs that have already been completed. Consecutive integers are separated by a single space.

-----Output-----

The output for each test case consists of two lines. The first line is a list of the indices of the jobs assigned to the Chef. The second line is a list of the indices of the jobs assigned to his assistant. Both lists must appear in increasing order of indices and consecutive integers should be separated by a single space. If either the Chef or the assistant is not assigned any jobs, then their corresponding line should be blank.

-----Example-----
Input:
3
6 3
2 4 1
3 2
3 2
8 2
3 8

Output:
3 6
5
1

1 4 6
2 5 7

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	M = list(map(int, input().split()))
	chef = []
	assistant = []
	count = 0
	for i in range(1, n + 1):
		if i in M:
			continue
		elif count % 2 == 0:
			count += 1
			chef.append(i)
		else:
			count += 1
			assistant.append(i)
	if len(chef) != 0:
		for k in chef:
			print(k, end=' ')
		print()
	else:
		print(-1)
	if len(assistant) != 0:
		for k in assistant:
			print(k, end=' ')
		print()
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	complete = sorted(list(map(int, input().split())))
	jobs = sorted(list(range(1, n + 1)))
	for ele in complete:
		if ele in jobs:
			jobs.remove(ele)
	chef = list()
	assistant = list()
	for i in range(len(jobs)):
		if i % 2 == 0:
			chef.append(str(jobs[i]))
		else:
			assistant.append(str(jobs[i]))
	if len(chef) == 0:
		print('-1')
	else:
		print(' '.join(chef))
	if len(assistant) == 0:
		print('-1')
	else:
		print(' '.join(assistant))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	d = list(map(int, input().split()))
	jobs = []
	for i in range(1, n + 1):
		if i not in d:
			jobs.append(i)
	chef = jobs[::2]
	assistant = jobs[1::2]
	if chef == []:
		print(-1)
	else:
		print(*chef)
	if assistant == []:
		print(-1)
	else:
		print(*assistant)


def work(n, m, completed):
	chef = []
	asst = []
	total_jobs = list(range(1, n + 1))
	pending = [value for value in total_jobs if value not in completed]
	for k in range(len(pending)):
		if k % 2 == 0:
			chef.append(pending[k])
		else:
			asst.append(pending[k])
	return (chef, asst)

def main():
	T = int(input())
	for t in range(T):
		jobs = input().split()
		n = int(jobs[0])
		m = int(jobs[1])
		completed = sorted(list(map(int, input().split())))
		(chef, asst) = work(n, m, completed)
		for j in chef:
			print(j, end=' ')
		print()
		for k in asst:
			print(k, end=' ')
		print()

def __starting_point():
	main()
__starting_point()


n = int(input())
for _ in range(n):
	(c, a) = ([], [])
	tot = list(map(int, input().split()))
	done = list(map(int, input().split()))
	for i in range(1, tot[0] + 1):
		if i in done:
			continue
		elif len(c) <= len(a):
			c.append(i)
		else:
			a.append(i)
	c.sort()
	a.sort()
	for j in c:
		print(j, end=' ')
	print()
	for k in a:
		print(k, end=' ')
	print()


T = int(input())
while T:
	T -= 1
	(totalJobs, completedJobs) = map(int, input().split())
	iJobs = []
	cJobs = []
	chef = []
	assistant = []
	cJobs = [int(i) for i in input().split()]
	for i in range(1, totalJobs + 1):
		if i not in cJobs:
			iJobs.append(i)
	iJobs.sort()
	for i in range(len(iJobs)):
		if i % 2 == 0:
			chef.append(iJobs[i])
		else:
			assistant.append(iJobs[i])
	print(' '.join([str(i) for i in chef]))
	print(' '.join([str(i) for i in assistant]))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	done = list(map(int, input().split()))
	li = [i for i in range(1, n + 1) if i not in done]
	chef = li[::2]
	assis = li[1::2]
	if not chef:
		print(-1)
	else:
		print(*chef)
	if not assis:
		print(-1)
	else:
		print(*assis)


for tc in range(int(input())):
	(n, m) = map(int, input().split())
	c = list(map(int, input().split()))
	chef = []
	asst = []
	next = 0
	for i in range(1, n + 1):
		if i not in c:
			if next == 0:
				chef.append(i)
				next = 1
			else:
				asst.append(i)
				next = 0
	if len(chef) == 0:
		print(-1)
	else:
		print(*chef)
	if len(asst) == 0:
		print(-1)
	else:
		print(*asst)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	fin = set([int(x) for x in input().split()])
	a = set(range(1, a + 1))
	a = sorted(list(a.difference(fin)))
	(c1, c2) = ([], [])
	for i in range(len(a)):
		if i % 2:
			c2.append(a[i])
		else:
			c1.append(a[i])
	if c1:
		print(*c1)
	else:
		print(-1)
	if c2:
		print(*c2)
	else:
		print(-1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	done = list(map(int, input().split()))
	chef = []
	assis = []
	t = True
	for i in range(1, n + 1):
		if i not in done:
			if t:
				chef.append(i)
				t = False
			else:
				assis.append(i)
				t = True
	if not chef:
		print(-1)
	else:
		print(*chef)
	if not assis:
		print(-1)
	else:
		print(*assis)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	arr = [int(j) for j in input().split()]
	job = [int(x) for x in range(1, n + 1)]
	chef = []
	assist = []
	prev = 0
	for i in range(len(job)):
		if job[i] in arr:
			continue
		elif prev == 0:
			chef.append(job[i])
			prev = job[i]
		elif prev in chef:
			assist.append(job[i])
			prev = job[i]
		elif prev in assist:
			chef.append(job[i])
			prev = job[i]
	if len(chef) != 0:
		print(*chef)
	else:
		print(-1)
	if len(assist) != 0:
		print(*assist)
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	done_task = list(map(int, input().split()))
	done_task.sort()
	left_tasks = []
	chef = []
	assist = []
	for i in range(n):
		if i + 1 not in done_task:
			left_tasks.append(i + 1)
	for i in range(n - m):
		if i % 2 == 0:
			chef.append(left_tasks[i])
		else:
			assist.append(left_tasks[i])
	print(*chef)
	print(*assist)


import sys
from math import *
from collections import *
from itertools import *

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

def str_arr():
	return list(map(str, input().split()))

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

def two_str():
	return map(str, input().split())
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 9)

def solve(n, c, lis):
	arr = [i for i in range(1, n + 1) if i not in lis]
	chef = arr[::2]
	ass = arr[1::2]
	print(*chef, end=' ')
	print()
	print(*ass, end=' ')
	print()
for _ in range(int(input())):
	(n, c) = map(int, input().split())
	lis = int_arr()
	solve(n, c, lis)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	l = list(range(1, n + 1))
	for i in a:
		if i in l:
			l.remove(i)
	chef = []
	assistant = []
	for i in range(len(l)):
		if i % 2 == 0:
			chef.append(l[i])
		else:
			assistant.append(l[i])
	if len(chef) == 0:
		print(-1)
	else:
		print(*chef)
	if len(assistant) == 0:
		print(-1)
	else:
		print(*assistant)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = [int(i) for i in input().split()]
	d = [int(i) for i in range(1, a + 1)]
	d = list(set(d) - set(c))
	d.sort()
	j = 0
	while j < len(d):
		print(d[j], end=' ')
		j += 2
	j = 1
	print()
	while j < len(d):
		print(d[j], end=' ')
		j += 2
	print()


t = int(input())
while t != 0:
	(n, f) = map(int, input().split())
	l = list(map(int, input().split()))
	if len(l) == n:
		print('-1\n-1')
	else:
		j = 0
		a = []
		for k in range(1, n + 1):
			if k not in l:
				if j == 0:
					print(k, end=' ')
					j = 1
				else:
					a.append(k)
					j = 0
		print()
		if len(a) == 0:
			print('-1')
		else:
			for k in a:
				print(k, end=' ')
			print()
	t -= 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	mLi = list(map(int, input().split()))
	nLi = [i for i in range(1, n + 1) if i not in mLi]
	x = []
	y = []
	for j in range(len(nLi)):
		if j % 2 == 0:
			x.append(nLi[j])
		else:
			y.append(nLi[j])
	print(*x, sep=' ')
	print(*y, sep=' ')


a = int(input(''))
for i in range(a):
	(N, M) = [int(x) for x in input('').split()]
	T = [int(x) for x in input('').split()]
	l = []
	l1 = []
	l2 = []
	for j in range(1, N + 1):
		if j not in T:
			l.append(j)
	k = l.sort()
	for h in range(0, len(l)):
		if h % 2 != 0:
			l1.append(str(l[h]))
		else:
			l2.append(str(l[h]))
	if len(l2) > 0:
		print(' '.join(l2))
	else:
		print(-1)
	if len(l1) > 0:
		print(' '.join(l1))
	else:
		print(-1)


t = int(input())
for i in range(t):
	b = []
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	a = input().split()
	for j in range(m):
		a[j] = int(a[j])
	p = 1
	while p <= n:
		if p not in a:
			b.append(p)
			p = p + 1
		else:
			p = p + 1
	for j in range(0, len(b), 2):
		print(b[j], end=' ')
	print()
	for j in range(1, len(b), 2):
		print(b[j], end=' ')
	print()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	c = []
	for i in range(1, a + 1):
		if i not in l:
			c.append(i)
	z = []
	x = []
	for j in range(a - b):
		if j % 2 != 0:
			z.append(c[j])
		else:
			x.append(c[j])
	if len(x) == 0:
		x.append(-1)
	if len(z) == 0:
		z.append(-1)
	print(*x)
	print(*z)


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	L = list(map(int, input().split()))[:K]
	(A, C, D) = ([], [], [])
	for j in range(1, N + 1):
		if j not in L:
			A.append(j)
	for k in range(len(A)):
		if k % 2 == 0:
			C.append(A[k])
		else:
			D.append(A[k])
	for j in C:
		print(j, end=' ')
	print()
	for k in D:
		print(k, end=' ')
	print()


for i in range(int(input())):
	(n, m) = map(int, input().split())
	t = list(map(int, input().split()))
	x = [i for i in range(1, n + 1) if i not in t]
	c = [i for i in x[::2]]
	a = [i for i in x[1::2]]
	if c:
		print(*c)
	else:
		print(-1)
	if a:
		print(*a)
	else:
		print(-1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	completed = list(map(int, input().split()))
	tasks = [_ for _ in range(1, n + 1) if _ not in completed]
	chef = tasks[::2]
	assistant = tasks[1::2]
	if chef == []:
		print(-1)
	else:
		for _ in chef:
			print(_, end=' ')
		print()
	if assistant == []:
		print(-1)
	else:
		for _ in assistant:
			print(_, end=' ')
		print()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	x = []
	y = []
	f = 0
	g = 0
	for j in range(1, a + 1):
		if j in l:
			h = 0
		elif f == 0:
			x.append(int(j))
			f = 1
			g = 0
		elif g == 0:
			y.append(int(j))
			g = 1
			f = 0
	if len(x) == 0:
		print(-1)
	else:
		print(*x)
	if len(y) == 0:
		print(-1)
	else:
		print(*y)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split(' '))
	a = list(map(int, input().split()))[:m]
	c = [x for x in range(1, n + 1)]
	d = []
	e = []
	for j in a:
		if j in c:
			del c[c.index(j)]
	for i in range(len(c)):
		if i % 2 == 0:
			d.append(c[i])
		else:
			e.append(c[i])
	if d == []:
		print(-1)
	else:
		print(*d)
	if e == []:
		print(-1)
	else:
		print(*e)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	x = [i for i in range(1, a + 1)]
	k = []
	k1 = []
	m = []
	for i in x:
		if i not in l:
			k.append(i)
	for i in range(len(k)):
		if i % 2 == 0:
			k1.append(k[i])
		else:
			m.append(k[i])
	if len(k1) != 0:
		print(*k1)
	else:
		print('-1')
	if len(m) != 0:
		print(*m)
	else:
		print('-1')


T = int(input())
for i in range(T):
	(n, m) = map(int, input().split())
	jobsList = []
	for j in range(n):
		jobsList.append(j + 1)
	jobsDone = list(map(int, input().split()))
	for k in range(m):
		jobsList.remove(jobsDone[k])
	l = 0
	p = 1
	jobsA = []
	jobsB = []
	while l < len(jobsList):
		jobsA.append(jobsList[l])
		l += 2
	while p < len(jobsList):
		jobsB.append(jobsList[p])
		p += 2
	for q in range(len(jobsA)):
		print(jobsA[q], end=' ')
	print()
	for r in range(len(jobsB)):
		print(jobsB[r], end=' ')
	print()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	x = []
	xx = []
	yy = []
	for i in range(1, n + 1):
		if i not in a:
			x.append(i)
	i = 0
	while i < len(x):
		if i % 2 == 1:
			xx.append(str(x[i]))
		elif i % 2 == 0:
			yy.append(str(x[i]))
		i += 1
	if len(yy) > 0:
		print(' '.join(yy))
	else:
		print(-1)
	if len(xx) > 0:
		print(' '.join(xx))
	else:
		print(-1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = []
	for i in range(1, n + 1):
		if i not in a:
			b.append(i)
	c = []
	d = []
	for i in range(len(b)):
		if i % 2 == 0:
			c.append(b[i])
		else:
			d.append(b[i])
	if len(c) == 0:
		print(-1)
	else:
		print(*c)
	if len(d) == 0:
		print(-1)
	else:
		print(*d)


q = int(input())
for it in range(q):
	(n, c) = map(int, input().split())
	a = set(map(int, input().split()))
	ch = list()
	asi = list()
	f = 0
	for i in range(1, n + 1):
		if i not in a and f % 2 == 0:
			ch.append(i)
			f += 1
			continue
		if i <= n and i not in a and (f % 2 == 1):
			asi.append(i)
			f += 1
	if len(ch) == 0:
		print(-1)
	else:
		print(*ch)
	if len(asi) == 0:
		print(-1)
	else:
		print(*asi)


def solve():
	t = int(input())
	for _ in range(t):
		(n, m) = [int(x) for x in input().split()]
		cmpl = [int(x) for x in input().split()]
		uncmpl = [i for i in range(1, n + 1) if i not in cmpl]
		l1 = []
		l2 = []
		for i in range(len(uncmpl)):
			if i & 1 == 0:
				l1.append(uncmpl[i])
			else:
				l2.append(uncmpl[i])
		print(*l1)
		print(*l2)
solve()


t = int(input())
for a in range(t):
	(n, m) = map(int, input().split())
	wk = list(range(1, n + 1))
	wd = list(map(int, input().split()))
	for a in wd:
		wk.remove(a)
	c = 0
	chef = []
	ass = []
	for a in wk:
		if c % 2 == 0:
			chef.append(str(a))
		else:
			ass.append(str(a))
		c += 1
	str1 = ' '
	str2 = ' '
	if str1.join(chef) == '':
		print(-1)
	else:
		print(str1.join(chef))
	if str2.join(ass) == '':
		print(-1)
	else:
		print(str2.join(ass))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	mlist = list(map(int, input().split()))
	mylis = []
	chf = []
	ass = []
	for i in range(1, n + 1):
		if i in mlist:
			continue
		else:
			mylis.append(i)
	for i in range(1, 1 + len(mylis)):
		if i % 2:
			chf.append(mylis[i - 1])
		else:
			ass.append(mylis[i - 1])
	if chf == []:
		print(-1)
	else:
		print(*chf, sep=' ')
	if ass == []:
		print(-1)
	else:
		print(*ass, sep=' ')


def work(a):
	chef = []
	asst = []
	c = True
	t = False
	for i in range(1, len(a)):
		if a[i] != 1:
			if c:
				chef.append(i)
				c = False
				t = True
			else:
				asst.append(i)
				t = False
				c = True
	return (chef, asst)
t = int(input())
while t:
	(n, m) = [int(k) for k in input().split()]
	a = [0] * (n + 1)
	finished = [int(k) for k in input().split()]
	for i in finished:
		a[i] = 1
	(chef, asst) = work(a)
	for i in chef:
		print(i, end=' ')
	print()
	for i in asst:
		print(i, end=' ')
	print()
	t -= 1


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	not_done = [i for i in range(1, n + 1) if i not in arr]
	chef = [not_done[i] for i in range(len(not_done)) if i % 2 == 0]
	assis = [not_done[i] for i in range(len(not_done)) if i % 2 == 1]
	print(*chef)
	print(*assis)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	Completed = set(map(int, input().split()))
	Chef_jobs = []
	Ast_jobs = []
	current = 1
	for i in range(1, n + 1):
		if i not in Completed:
			if current & 1:
				Chef_jobs.append(i)
			else:
				Ast_jobs.append(i)
			current += 1
	print(*Chef_jobs) if Chef_jobs else print(-1)
	print(*Ast_jobs) if Ast_jobs else print(-1)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	idx = list((j for j in range(1, n + 1)))
	for k in a:
		idx.remove(k)
	chef = []
	assisant = []
	for l in range(len(idx)):
		if l % 2 == 0:
			chef.append(idx[l])
		else:
			assisant.append(idx[l])
	if len(chef) != 0:
		print(*chef)
	else:
		print(-1)
	if len(assisant) != 0:
		print(*assisant)
	else:
		print(-1)


T = int(input())
for i in range(T):
	(n, m) = map(int, input().split())
	lst = list(map(int, input().split()))
	arr = []
	chef = []
	ass = []
	for i in range(1, n + 1):
		if i not in lst:
			arr.append(i)
	for i in range(len(arr)):
		if i % 2 == 0:
			chef.append(arr[i])
		else:
			ass.append(arr[i])
	if chef:
		print(*chef)
	else:
		print(-1)
	if ass:
		print(*ass)
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	ar = list(map(int, input().split()))
	vis = [0] * (n + 1)
	vis[0] = -1
	for j in range(m):
		vis[ar[j]] = -1
	shift = 1
	ans = ''
	ans_ast = ''
	for k in range(1, n + 1):
		if vis[k] != -1:
			if shift == 1:
				shift = 0
				ans += str(k) + ' '
			else:
				shift = 1
				ans_ast += str(k) + ' '
	if ans == '':
		print(-1)
	else:
		print(ans)
	if ans_ast == '':
		print(-1)
	else:
		print(ans_ast)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	fin = list(map(int, input().split())) + [1001]
	fin.sort()
	fini = 0
	todo = [[], []]
	curr = 0
	for i in range(1, n + 1):
		if i == fin[0]:
			fin = fin[1:]
		else:
			todo[curr] += [i]
			curr = 1 - curr
	if len(todo[0]) > 0:
		print(*todo[0])
	else:
		print(-1)
	if len(todo[1]) > 0:
		print(*todo[1])
	else:
		print(-1)


tests = int(input())
for i in range(tests):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	count = 0
	chef = []
	assistant = []
	for j in range(1, n + 1):
		if j not in arr:
			if count & 1:
				assistant.append(j)
				count += 1
			else:
				chef.append(j)
				count += 1
	if len(chef) == 0:
		print(-1)
	else:
		print(*chef)
	if len(assistant) == 0:
		print(-1)
	else:
		print(*assistant)


for _ in range(int(input())):
	s = []
	m = list(map(int, input().split()))
	n = list(map(int, input().split()))
	n.sort()
	l = sorted(set(range(1, m[0] + 1)) - set(n))
	p = []
	q = []
	for j in range(len(l)):
		if j % 2 != 0:
			q.append(l[j])
		else:
			p.append(l[j])
	if len(p) != 0:
		print(*p)
	else:
		print('-1')
	if len(q) != 0:
		print(*q)
	else:
		print('-1')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	list1 = list(map(int, input().split()))
	list1.sort()
	list2 = [i for i in range(1, n + 1) if not i in list1]
	list2.sort()
	cheflist = [list2[i] for i in range(len(list2)) if i % 2 == 0]
	asslist = [list2[i] for i in range(len(list2)) if i % 2 != 0]
	str1 = ''
	str2 = ''
	for i in cheflist:
		if i == cheflist[len(cheflist) - 1]:
			str1 += str(i)
		else:
			str1 += str(i) + ' '
	for i in asslist:
		if i == cheflist[len(cheflist) - 1]:
			str2 += str(i)
		else:
			str2 += str(i) + ' '
	print(str1)
	print(str2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	lm = [int(item) for item in input().split()]
	l = [item for item in range(1, n + 1)]
	for i in lm:
		l.remove(i)
	l.sort()
	list_chef = list()
	list_assistant = list()
	for i in range(0, len(l), 2):
		list_chef.append(l[i])
	for i in range(1, len(l), 2):
		list_assistant.append(l[i])
	print(*list_chef)
	print(*list_assistant)


vishnesh = int(input())
for vish in range(vishnesh):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	s = list(range(1, n + 1))
	for i in range(k):
		s.remove(arr[i])
	if n - k == 0:
		print(-1, end=' ')
	i = 0
	while i < n - k:
		print(s[i], end=' ')
		i = i + 2
	print()
	if n - k < 2:
		print(-1, end=' ')
	i = 1
	while i < n - k:
		print(s[i], end=' ')
		i = i + 2
	print()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		d[i] = 1
	che = []
	c = 0
	me = []
	for i in range(1, n + 1):
		if i not in d:
			if c % 2 == 0:
				che.append(i)
				c += 1
			else:
				me.append(i)
				c += 1
	if len(che) > 0:
		che.sort()
		print(*che)
	else:
		print(-1)
	if len(me) > 0:
		me.sort()
		print(*me)
	else:
		print(-1)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	(l1, l2, l3) = ([], [], [])
	for j in range(1, n + 1):
		l1.append(j)
	for x in l:
		if x in l1:
			l1.remove(x)
	for i in range(len(l1)):
		l2 = [l1[i] for i in range(len(l1)) if i % 2 == 0]
		l3 = [l1[i] for i in range(len(l1)) if i % 2 != 0]
	if l2 == []:
		print('-1')
	else:
		for x in l2:
			print(x, end=' ')
		print()
	if l3 == []:
		print('-1')
	else:
		for x in l3:
			print(x, end=' ')
		print()


def check(l, n, m):
	k = []
	p = []
	c = 0
	for i in range(1, n + 1):
		if i not in l and c % 2 == 0:
			k.append(i)
			c += 1
		elif i not in l and c % 2 == 1:
			p.append(i)
			c += 1
	if len(k) == 0:
		print(-1)
	else:
		print(*k)
	if len(p) == 0:
		print(-1)
	else:
		print(*p)
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	check(l, n, m)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	l = []
	for j in range(1, n + 1):
		if j not in a:
			l.append(j)
	k = len(l)
	s1 = ''
	s2 = ''
	for x in range(k):
		if x % 2 == 0:
			s1 = s1 + str(l[x]) + ' '
		else:
			s2 = s2 + str(l[x]) + ' '
	if s1 != '' and s2 != '':
		print(s1)
		print(s2)
	if s1 != '' and s2 == '':
		print(s1)
		print('-1')
	if s1 == '' and s2 == '':
		print('-1')
		print('-1')


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	completed = list(map(int, input().split()))
	jobs = []
	for i in range(1, n + 1):
		if i not in completed:
			jobs.append(i)
	jobs.sort()
	chef = []
	ass = []
	for i in range(len(jobs)):
		if i % 2 == 0:
			chef.append(str(jobs[i]))
		else:
			ass.append(str(jobs[i]))
	print(' '.join(chef))
	print(' '.join(ass))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	(s, ch, ass) = (0, [], [])
	for i in range(1, a + 1):
		if i in l:
			pass
		elif s % 2 == 0:
			ch.append(i)
			s += 1
		else:
			ass.append(i)
			s += 1
	if len(ch) == 0:
		print(-1)
	else:
		print(*ch)
	if len(ass) == 0:
		print(-1)
	else:
		print(*ass)


t = input()
for c in range(0, int(t)):
	(n, m) = input().split()
	a = input().split()
	arr = []
	for x in a:
		arr.append(int(x))
	chef = ''
	assistant = ''
	flip = 0
	for y in range(0, int(n)):
		if y + 1 not in arr:
			if flip == 0:
				chef = chef + str(y + 1) + ' '
				flip = 1
			else:
				assistant = assistant + str(y + 1) + ' '
				flip = 0
	if chef == '':
		chef = '-1'
	if assistant == '':
		assistant = '-1'
	print(chef)
	print(assistant)


for _ in range(int(input())):
	(n, m) = list(map(int, input().split(' ')))
	v = list(map(int, input().split(' ')))
	t = [i for i in range(1, n + 1)]
	r = []
	a = []
	b = []
	for i in t:
		if i not in v:
			r.append(i)
	for i in range(1, len(r) + 1, 2):
		a.append(r[i - 1])
	for i in range(2, len(r) + 1, 2):
		b.append(r[i - 1])
	if len(a) == 0:
		print(-1)
	else:
		for i in a:
			print(i, end=' ')
		print(' ')
	if len(b) == 0:
		print(-1)
	else:
		for i in b:
			print(i, end=' ')
		print(' ')


passes = int(input())
while passes != 0:
	(n, m) = map(int, input().split())
	chef = list([])
	assistant = list([])
	completed = list(map(int, input().split()))
	total = [x + 1 for x in list(range(n))]
	s = 0
	for i in total:
		if i in completed:
			pass
		elif s == 0:
			chef.append(i)
			s = 1
		elif s == 1:
			assistant.append(i)
			s = 0
	if len(chef) == 0:
		chef.append(-1)
	if len(assistant) == 0:
		assistant.append(-1)
	for x in chef:
		print(x, end=' ')
	print()
	for x in assistant:
		print(x, end=' ')
	print()
	passes -= 1


t = int(input())
while t:
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	c = []
	a = []
	count = 0
	for i in range(1, n + 1):
		if i not in l:
			count = count + 1
			if count % 2 != 0:
				c.append(i)
			else:
				a.append(i)
	if not c:
		print(-1)
	else:
		for i in c:
			print(i, end=' ')
	print()
	if not a:
		print(-1)
	else:
		for i in a:
			print(i, end=' ')
	print()
	t = t - 1


T = int(input())
for i in range(T):
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	A.sort()
	chef = []
	assist = []
	chefJob = True
	for j in range(n):
		if j + 1 not in A:
			if chefJob:
				chef.append(j + 1)
				chefJob = False
			else:
				assist.append(j + 1)
				chefJob = True
	chefStr = ' '.join((str(s) for s in chef))
	assistStr = ' '.join((str(s) for s in assist))
	if len(chefStr):
		print(chefStr)
	else:
		print(-1)
	if len(assistStr):
		print(assistStr)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	mlst = list(map(int, input().split()))
	lst = []
	chef = []
	ass = []
	mlst.sort()
	for i in range(1, n + 1):
		if i not in mlst:
			lst.append(i)
	for j in range(1, len(lst) + 1):
		if j % 2 != 0:
			print(lst[j - 1], end=' ')
		else:
			ass.append(lst[j - 1])
	print()
	print(*ass, sep=' ')


for _ in range(int(input())):
	[n, m] = [int(i) for i in input().split()]
	l = sorted([int(i) for i in input().split()])
	tempI = 1
	aI = 0
	temp = []
	while tempI <= n:
		if aI < m and tempI == l[aI]:
			aI += 1
			tempI += 1
			continue
		temp.append(tempI)
		tempI += 1
	if n - m <= 0:
		print()
		print()
		continue
	if n - m == 1:
		print(temp[0])
		print()
		continue
	for i in range(0, n - m, 2):
		print(temp[i], end=' ')
	print()
	for i in range(1, n - m, 2):
		print(temp[i], end=' ')
	print()


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	idx = list((i for i in range(1, m + 1)))
	for i in a:
		idx.remove(i)
	chef = []
	assidtant = []
	for i in range(len(idx)):
		if i % 2 == 0:
			chef.append(idx[i])
		else:
			assidtant.append(idx[i])
	if len(chef) != 0:
		print(*chef)
	else:
		print(-1)
	if len(assidtant) != 0:
		print(*assidtant)
	else:
		print(-1)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	c = []
	a = []
	k = 0
	for i in range(1, n + 1):
		if i not in l:
			if k % 2 == 0:
				c.append(i)
				k += 1
			else:
				a.append(i)
				k += 1
	if len(c) > 0:
		print(*c)
	else:
		print(-1)
	if len(a) > 0:
		print(*a)
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = []
	(ch, assis) = ([], [])
	for i in range(1, n + 1):
		l1.append(i)
	for i in range(len(l)):
		l1.remove(l[i])
	for i in range(len(l1)):
		if i % 2 == 0:
			ch.append(l1[i])
		else:
			assis.append(l1[i])
	if len(ch) == 0:
		print(-1)
	else:
		for i in range(len(ch)):
			print(ch[i], end=' ')
		print()
	if len(assis) == 0:
		print(-1)
	else:
		for i in range(len(assis)):
			print(assis[i], end=' ')
		print()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = set([i for i in range(1, n + 1)])
	chef = []
	ass = []
	b = set([int(x) for x in input().split()])
	a = sorted(a - b)
	i = 0
	if i >= len(a):
		print(-1, end=' ')
	while i < len(a):
		print(a[i], end=' ')
		i += 2
	print()
	i = 1
	if i >= len(a):
		print(-1, end=' ')
	while i < len(a):
		print(a[i], end=' ')
		i += 2
	print()


for i in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	l = list(map(int, input().split()))
	g = []
	for i in range(1, n + 1):
		g.append(i)
	un = [each for each in g if each not in l]
	chef = un[::2]
	ass = un[1::2]
	print(*chef)
	print(*ass)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	done = list(map(int, input().split()))
	b = []
	chef = []
	assistant = []
	for i in range(1, n + 1):
		if i not in done:
			b.append(i)
	chef = b[::2]
	assistant = b[1:n + 1:2]
	if len(chef) != 0:
		print(*chef)
	else:
		print('-1')
	if len(assistant) != 0:
		print(*assistant)
	else:
		print('-1')


test_cases = int(input())
for i in range(test_cases):
	chefList = []
	assistantList = []
	(n, m) = map(int, input().split())
	jobsCompleted = set(map(int, input().split()))
	totalJobs = set(range(1, n + 1))
	remainingJobs = list(totalJobs - jobsCompleted)
	remainingJobs.sort()
	for j in range(len(remainingJobs)):
		if j % 2 == 0:
			chefList.append(remainingJobs[j])
		else:
			assistantList.append(remainingJobs[j])
	print(*chefList)
	print(*assistantList)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	l = []
	chef = []
	assist = []
	for i in range(1, n + 1):
		l.append(i)
	for i in a:
		l.remove(i)
	for i in range(len(l)):
		if i % 2 == 0:
			chef.append(l[i])
		else:
			assist.append(l[i])
	if len(chef) == 0 and len(assist) == 0:
		print(-1)
		print(-1)
	elif len(chef) == 0 and len(assist) != 0:
		print(-1)
		print(*assist)
	elif len(chef) != 0 and len(assist) == 0:
		print(*chef)
		print(-1)
	else:
		print(*chef)
		print(*assist)


t = int(input())
while t:
	(n, m) = [int(x) for x in input().split()]
	job_done = [int(x) for x in input().split()]
	li = []
	for i in range(1, n + 1):
		if i not in job_done:
			li.append(i)
	chef = []
	assis = []
	for i in range(len(li)):
		if i & 1:
			assis.append(li[i])
		else:
			chef.append(li[i])
	print(*chef)
	print(*assis)
	t = t - 1


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = [int(i) for i in input().split()]
	arr = []
	for i in range(1, n + 1):
		arr.append(i)
	for i in range(len(a)):
		if a[i] in arr:
			arr.remove(a[i])
	chef = arr[::2]
	assis = arr[1:n + 1:2]
	if len(chef) != 0:
		print(*chef)
	else:
		print('-1')
	if len(assis) != 0:
		print(*assis)
	else:
		print('-1')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	rea = [x for x in range(1, n + 1)]
	for j in arr:
		if j in rea:
			del rea[rea.index(j)]
	chef = []
	ass = []
	for k in range(len(rea)):
		if k % 2 == 0:
			chef.append(rea[k])
		else:
			ass.append(rea[k])
	if chef == []:
		print(-1)
	else:
		print(*chef)
	if ass == []:
		print('-1')
	else:
		print(*ass)


import sys
import math
from collections import *
from itertools import *

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

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

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

def get_str():
	return map(str, sys.stdin.readline().strip().split())
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 9)

def solve(n, m, lis):
	arr = [i for i in range(1, n + 1) if i not in lis]
	chef = arr[::2]
	ass = arr[1::2]
	print(*chef, end=' ')
	print()
	print(*ass, end=' ')
	print()
for _ in range(int(input())):
	(n, m) = get_int()
	cleaned = int_arr()
	solve(n, m, cleaned)


t = int(input())
for _ in range(0, t):
	(n, m) = list(map(int, input().split()))
	x = list(range(1, n + 1))
	y = list(map(int, input().split()))
	for i in y:
		x.remove(i)
	(a, b) = ([], [])
	for j in range(0, len(x)):
		if j % 2 == 0:
			a.append(x[j])
		else:
			b.append(x[j])
	print(*a) if len(a) != 0 else print(-1)
	print(*b) if len(b) != 0 else print(-1)