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

for _ in range(t):
    input()
    k, n, m = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    ai = 0
    bi = 0
    pred = k
    res = []
    while ai < n or bi < m:
        while ai < n and a[ai] <= k:
            res.append(a[ai])
            if a[ai] == 0:
                k += 1
            ai += 1

        while bi < m and b[bi] <= k:
            res.append(b[bi])
            if b[bi] == 0:
                k += 1
            bi += 1
        if k == pred:
            res = [-1]
            break
        pred = k
    for i in res:
        print(i, end=' ')
    print()
