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: interview

Starter code:

Solutions:
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))

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

# cook your dish here
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

# cook your dish here
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)

# cook your dish here
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)

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)

# import sys
# def fast():
#     sys.stdin = open("input.txt", "r")
#     sys.stdout = open("output.txt", "w")
# fast()
solve()

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)

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

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

# cook your dish here
T = int(input())

while T:
 T -= 1
 totalJobs, completedJobs = map(int, input().split())
 iJobs = [] # incompleted jobs
 cJobs = [] # complete jobs
 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]))

# cook your dish here
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)

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 _ 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 = " ")

# cook your dish here
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)
  
 
  


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

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
  else:
   if 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())

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

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

# cook your dish here
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):
   # chef.append(lst[j-1])
   print(lst[j-1],end=' ')
  else:
   ass.append(lst[j-1])
   # print(lst[j-1],end=' ')
 print()
 print(*ass, sep=' ')


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)

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)

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 _ 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
 #print(temp)
 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()