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 <bits/stdc++.h>
using namespace std;
int main() {
  long long T;
  cin >> T;
  for (long long i = 0; i < T; i++) {
    long long k, n, m;
    cin >> k >> n >> m;
    vector<long long> a, b;
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      a.push_back(x);
    }
    for (long long i = 0; i < m; i++) {
      long long x;
      cin >> x;
      b.push_back(x);
    }
    while (a.size() != 0 || b.size() != 0) {
      if (a.size() == 0) {
        if (b[0] == 0) {
          k += 1;
          cout << b[0] << " ";
          b.erase(b.begin());
        } else if (b[0] <= k) {
          cout << b[0] << " ";
          b.erase(b.begin());
        } else {
          cout << -1;
          break;
        }
      } else if (b.size() == 0) {
        if (a[0] == 0) {
          k += 1;
          cout << a[0] << " ";
          a.erase(a.begin());
        } else if (a[0] <= k) {
          cout << a[0] << " ";
          a.erase(a.begin());
        } else {
          cout << -1;
          break;
        }
      } else {
        if (a[0] == 0) {
          k += 1;
          cout << a[0] << " ";
          a.erase(a.begin());
        } else if (b[0] == 0) {
          k += 1;
          cout << b[0] << " ";
          b.erase(b.begin());
        } else if (min(a[0], b[0]) <= k) {
          k += 1;
          if (a[0] == min(a[0], b[0])) {
            cout << a[0] << " ";
            a.erase(a.begin());
          } else {
            cout << b[0] << " ";
            b.erase(b.begin());
          }
        } else {
          cout << -1;
          break;
        }
      }
    }
    cout << endl;
  }
}
