T=int(input())
for i in range(T):
#cj=[]
n,m=map(int,input().split(' '))
cj=list(map(int,input().split(' ')))
#cj.extend(ele)
fele=[j for j in range(1,n+1)]
ex = [x for x in fele if x not in cj]
chef=[e for c,e in enumerate(ex) if c%2==0]
other=[e for d,e in enumerate(ex) if d%2==1]
for l in chef[:]:
print(l,end=' ')
print()
if not other:
print()
else:
for m in other:
print(m,end=' ')
Runs fine on local