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>
const double eps = 1e-8;
const double PI = acos(-1.0);
const long long N = 2e5 + 50;
const long long M = 1e9 + 10;
const long long inf = 0x3f3f3f3f;
const long long INF = 0x7fffffffffffffffll;
using namespace std;
long long n, m, k;
long long T, q;
signed main() {
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) {
    cin >> k >> n >> m;
    vector<long long> a, b;
    for (long long i = 0; i < n; i++) {
      cin >> q;
      a.push_back(q);
    }
    for (long long i = 0; i < m; i++) {
      cin >> q;
      b.push_back(q);
    }
    vector<long long> ans;
    long long f = 1, l1 = 0, l2 = 0;
    while (l1 < n || l2 < m) {
      while (l1 < n && a[l1] == 0) {
        ans.push_back(a[l1]);
        l1++;
        k++;
      }
      while (l2 < m && b[l2] == 0) {
        ans.push_back(b[l2]);
        l2++;
        k++;
      }
      if (l1 < n && a[l1] <= k) {
        ans.push_back(a[l1]);
        l1++;
      } else if (l2 < m && b[l2] <= k) {
        ans.push_back(b[l2]);
        l2++;
      } else {
        f = 0;
        break;
      }
    }
    if (f) {
      for (auto x : ans) {
        cout << x << " ";
      }
      cout << "\n";
    } else {
      cout << "-1"
           << "\n";
    }
  }
  return 0;
}
