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

for _ in range(int(input())):
    input()
    k, n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    a.reverse()
    b.reverse()
    ans = []
    gg = False
    while a and b:
        while a and a[-1] == 0:
            ans.append(a[-1])
            del a[-1]
            k += 1
        while b and b[-1] == 0:
            ans.append(b[-1])
            del b[-1]
            k += 1
        if not (a and b):
            break

        if a[-1] <= k:
            ans.append(a[-1])
            del a[-1]
        elif b[-1] <= k:
            ans.append(b[-1])
            del b[-1]
        else:
            print(-1)
            gg = True
            break
    if not gg:
        if any(i > k for i in a) or any(i > k for i in b):
            print(-1)
        else:
            ans += a[::-1]
            ans += b[::-1]
            print(*ans)
