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;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
const long long int inf = 9e18;
const long double pi = 2 * acos(0.0);
const int N = 1000005;
long long int tes, n;
vector<long long int> sieve(N, 0);
void si() {
  sieve[1] = 1;
  for (int i = 2; i < N; i++) {
    if (sieve[i] == 0) {
      for (int j = i; j < N; j += i) {
        sieve[j] = i;
      }
    }
  }
}
long long int power(long long int x, long long int y) {
  long long int res = 1ll;
  while (y > 0) {
    if (y & 1) res = res * x;
    res %= 998244353;
    y >>= 1;
    x = x * x;
    x %= 998244353;
  }
  return res;
}
void solve() {
  long long int k, m, poi1 = 0, poi2 = 0;
  cin >> k >> n >> m;
  vector<long long int> arr(n), brr(m), crr;
  ;
  for (int i = 0; i < n; i++) cin >> arr[i];
  ;
  for (int i = 0; i < m; i++) cin >> brr[i];
  while (poi1 < n || poi2 < m) {
    ;
    for (int i = poi1; i < n; i++) {
      if (arr[i] == 0) {
        k++, crr.push_back(0), poi1 = i + 1;
      } else {
        break;
      }
    };
    for (int i = poi2; i < m; i++) {
      if (brr[i] == 0) {
        k++, crr.push_back(0), poi2 = i + 1;
      } else {
        break;
      }
    }
    if (poi1 < n) {
      if (k >= arr[poi1]) {
        crr.push_back(arr[poi1]);
        poi1++;
      } else {
        cout << -1 << "\n";
        return;
      }
    }
    if (poi2 < m) {
      if (k >= arr[poi2]) {
        crr.push_back(brr[poi2]);
        poi2++;
      } else {
        cout << -1 << "\n";
        return;
      }
    }
  };
  for (int i = 0; i < (int)((crr).size()); i++) cout << crr[i] << " ";
  cout << "\n";
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> tes;
  while (tes--) {
    solve();
  }
}
