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())):
    waste = input()
    k,n,m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    
    lim = 700; flag = 0
    ans = []
    i = 0; j = 0
    while i<len(a) or j<len(b):
        while i<len(a) and a[i]<=k:
            if a[i]==0: k+=1
            ans.append(a[i])
            i+=1

        while j<len(b) and b[j] <= k:
            if b[j]==0: k+=1
            ans.append(b[j])
            j+=1
        lim-=1
        if lim==0: flag = 1 ; break

    print(*ans) if flag == 0 else print(-1)
