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

def actions():
    space = input()
    k, n, m = map(int, input().split())
    monocarp = list(map(int, input().split()))
    polycarp = list(map(int, input().split()))
    pages = set(range(1, k + 1))
    if len(pages) == 0:
        pages.add(0)
    sequence = []
    while len(polycarp) > 0 or len(monocarp) > 0:
        if len(polycarp) > 0 and polycarp[0] == 0:
            pages.add(max(pages) + 1)
            sequence.append(polycarp.pop(0))
            continue
        elif len(monocarp) > 0 and monocarp[0] == 0:
            pages.add(max(pages) + 1)
            sequence.append(monocarp.pop(0))
            continue
        elif len(polycarp) > 0 and polycarp[0] in pages:
            sequence.append(polycarp.pop(0))
            continue
        elif len(monocarp) > 0 and monocarp[0] in pages:
            sequence.append(monocarp.pop(0))
            continue
        return ["-1"]
    sequence = list(map(str, sequence))
    return sequence


ans = []
t = int(input())
for i in range(t):
    ans.append(actions())
for i in ans:
    print(" ".join(i))