5

3 2 2
2 0
0 5

4 3 2
2 0 5
0 6

0 2 2
1 0
2 3

5 4 4
6 0 8 0
0 7 0 9

5 4 1
8 7 8 0
0

0 2 0 5
0 2 0 5 6
-1
0 6 0 7 0 8 0 9
-1

t = int(raw_input())



# python comp123.py < input.txt

for x in range(t):
    ans = 0
    emp = raw_input()
    init = raw_input()
    monop = raw_input()
    polyc = raw_input()
    list_init = init.split()
    list_monop = monop.split()
    list_monop = map(int, list_monop)
    list_polyc = polyc.split()
    list_polyc = map(int, list_polyc)
    len_code = int(list_init[0])
    len_monop = int(list_init[1])
    len_polyc = int(list_init[2])
    res = 'a'
    list_monop.append(5000)
    list_polyc.append(5000)
    #print(list_monop)
    #print(list_polyc)
    for i in range((len_monop + len_polyc)):
        if list_monop[0] <= len_code:
            res = res + ' ' + str(list_monop[0])
            if list_monop[0] == 0:
                len_code = len_code + 1
            list_monop.pop(0)
        elif list_polyc[0] <= len_code:
            res = res + ' ' + str(list_polyc[0])
            if list_polyc[0] == 0:
                len_code = len_code + 1
            list_polyc.pop(0)
        else:
            ans = -1
        print(res[2:])

        #print(list_monop)
        #print(list_polyc)
    #for i in list_init:
    #    print(i)