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], ans[n + 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, p = 0;
  bool f = true;
  while (i < n && j < m) {
    if (a[i] > k && b[j] > k) {
      f = false;
      break;
    }
    if (a[i] == 0 || b[j] == 0) {
      if (a[i] == 0) {
        ans[p++] = a[i];
        i++;
      }
      if (b[j] == 0) {
        ans[p++] = b[j];
        j++;
      }
      k++;
    } else if (a[i] <= k) {
      ans[p++] = a[i];
      i++;
    } else if (b[j] <= k) {
      ans[p++] = b[j];
      j++;
    }
  }
  if (f) {
    while (i < n) {
      if (a[i] == 0) {
        ans[p++] = 0;
        i++;
        k++;
      } else if (a[i] <= k) {
        ans[p++] = a[i];
        i++;
      } else {
        f = false;
        break;
      }
    }
    while (j < m) {
      if (b[j] == 0) {
        ans[p++] = 0;
        j++;
        k++;
      } else if (b[j] <= k) {
        ans[p++] = b[j];
        j++;
      } else {
        f = false;
        break;
      }
    }
  }
  if (!f) {
    cout << -1;
    return;
  }
  for (int i = 0; i < n + m; i++) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
