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

#include <iostream>
#include <bits/stdc++.h>
#include <numeric>
#define ll long long
using namespace std;
void solve(){
    int k,n,m;
    cin>>k>>n>>m;
    vector<int>a(n),b(m);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) cin>>b[i];

    int i=0,j=0;
    vector<int>ans;
    while(i<n || j<m){
        if(i<n && j<m){
            if(a[i]==0) ans.push_back(0), i++, k++;
            else if(b[j]==0) ans.push_back(0), j++, k++;
            else{
                if(a[i]<b[j] && a[i]<=k) ans.push_back(a[i]), i++;
                else if(a[i]>=b[j] && b[j]<=k) ans.push_back(b[j]), j++;
                else{
                    cout<<-1<<"\n";
                    return;
                }
            }
        }
        else if(i<n){
            if(a[i]==0) ans.push_back(0), i++, k++;
            else{
                if(a[i]<=k) ans.push_back(a[i]), i++;
                else{
                    cout<<-1<<"\n";
                    return;
                }
            }
        }
        else if(j<m){
            if(b[j]==0) ans.push_back(0), j++, k++;
            else{
                if(b[j]<=k) ans.push_back(b[j]), j++;
                else{
                    cout<<-1<<"\n";
                    return;
                }
            }
        }
    }
    for(auto i : ans) cout<<i<<" ";
        cout<<"\n";
}  
 
int main(){
    ios::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            cout<<fixed;
            cout<<setprecision(10);
    //        freopen("timber_input.txt", "r", stdin);
    //        freopen("timber_output.txt", "w", stdout);
            int t=1;
            cin>>t;
            for(int i=1;i<=t;i++){
            //    cout<<"Case #"<<i<<": ";  
                solve();
    }
    return 0;
}