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


import java.util.*;
import java.io.*;
import java.lang.*;


public class Solution{
    public static void main(String[] args) {
        
        Scanner sc=new Scanner(System.in);
       
        
        int q=sc.nextInt();
        
        
        for(int x=0; x<q; x++)
        {
            int k=sc.nextInt();
            int n=sc.nextInt(), m=sc.nextInt();
            int[] mono=new int[n];
            int[] poly=new int[m];
            
            for(int i=0; i<n; i++)
                mono[i]=sc.nextInt();
            
            for(int i=0; i<m; i++)
                poly[i]=sc.nextInt();
            
            solve(k,n,m, mono, poly);
            
            System.out.println();
        }
        
    }
    
    
    public static void solve(int k, int n, int m, int[] mono, int[] poly){
        
        
        int[] ans=new int[n+m];

            
        int i=0, j=0, wait1=0, wait2=0, l=0;
        
        
        while(i<n || j<m)
        {
            if((wait1==1 && wait2==1) || (i==n && wait2==1) || (j==m && wait1==1)) break;
            
            
            
            if(i<n && mono[i]<=k) 
            {
                ans[l]=mono[i];
                l++;
                if(mono[i]==0) k++;
                i++;
                wait1=0;
            }
            else 
                wait1=1;
            
            
            
            if(j<m && poly[j]<=k)
            {
                ans[l]=poly[j];
                l++;
                if(poly[j]==0) k++;
                j++;
                wait2=0;
            }
            else 
                wait2=1;
        }
        
        if(i==n && j==m)
            for(int r=0; r<n+m; r++)
                System.out.print(ans[r] + " ");
        else
            System.out.print("-1");
    }
}