#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, inf = 0x3f3f3f3f;
int n, m, K;
int a[N], b[N], f[N], g[N], l[N], p[N], ans[N], mark[N];
void fill(int pos, int val, int &v) {
  int k = lower_bound(b + 1, b + m + 1, val) - b - 1;
  mark[k] = 1, ans[pos] = v = b[k];
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), f[i] = inf;
  ++n, a[n] = f[n] = inf;
  cin >> m;
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  sort(b + 1, b + m + 1);
  for (int i = 1; i <= n; i++) {
    if (~a[i]) {
      int j = lower_bound(f + 1, f + n + 1, a[i]) - f - 1;
      l[i] = j + 1, p[i] = g[j], f[j + 1] = a[i], g[j + 1] = i;
    } else {
      for (int j = n, k = m; k; --k) {
        while (f[j] >= b[k]) --j;
        f[j + 1] = b[k], g[j + 1] = i;
      }
    }
  }
  for (int i = l[n], j = n, v = a[n]; i; --i) {
    if (~a[j]) {
      if (!~a[p[j]])
        fill(p[j], a[j], v);
      else
        v = a[p[j]];
      j = p[j];
    } else {
      bool ff = 0;
      for (int k = j - 1; k; --k)
        if (~a[k] && l[k] == i - 1 && a[k] < v) {
          v = a[j = k];
          ff = 1;
          break;
        }
      if (ff) continue;
      for (int k = j - 1; k; --k)
        if (!~a[k]) {
          fill(k, v, v);
          j = k;
          break;
        }
    }
  }
  int k = 1;
  for (int i = 1; i <= n - 1; i++)
    if (!~a[i]) {
      if (ans[i]) continue;
      while (mark[k]) ++k;
      mark[k] = 1, ans[i] = b[k];
    } else
      ans[i] = a[i];
  for (int i = 1; i <= n - 1; i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
