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;
void solve() {
  int k, n, m;
  cin >> k >> n >> m;
  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 c0 = count(a, a + n, 0) + count(b, b + m, 0);
  int mx = max(*max_element(a, a + n), *max_element(b, b + m));
  if (k + c0 < mx) {
    cout << -1;
    return;
  }
  int p1 = n - 1, p2 = m - 1;
  vector<int> v;
  while (p1 >= 0 && p2 >= 0) {
    if (a[p1] == 0) {
      v.push_back(b[p2]);
      p2--;
    } else if (b[p2] == 0) {
      v.push_back(a[p1]);
      p1--;
    } else {
      if (a[p1] > b[p2]) {
        v.push_back(a[p1]);
        p1--;
      } else {
        v.push_back(b[p2]);
        p2--;
      }
    }
  }
  while (p1 >= 0) {
    v.push_back(a[p1]);
    p1--;
  }
  while (p2 >= 0) {
    v.push_back(b[p2]);
    p2--;
  }
  reverse(v.begin(), v.end());
  for (auto i : v) cout << i << " ";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
}
