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.Scanner;
import java.util.Vector;

public class Pair_Programming {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int  t = sc.nextInt();
        while(t-->0){
            int k = sc.nextInt();
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[m];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }
            for (int i = 0; i < m; i++) {
                b[i] = sc.nextInt();
            }
            Vector<Integer> vector = new Vector<>();
            int low = 0;
            int high = 0;
            while(true){
                if(low<n && k>=a[low]){
                    if(a[low] == 0) {
                        k++;
                    }
                    vector.add(a[low]);
                    low++;
                }
                else if(high<m && k>= b[high]){
                    if(b[high] == 0){
                        k++;
                    }
                    vector.add(b[high]);
                    high++;
                }
                else{
                    break;
                }
            }
            if(low<n || high<m){
                System.out.println(-1);
                continue;
            }
            for (int e: vector) {
                System.out.print(e+" ");
            }
            System.out.println();
        }
    }
}
