#include <bits/stdc++.h>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
const int N = 1e5 + 5, oo = 1e9 + 7;
int n, m, a[N], ans[N], b[N], f[N], g[N], l[N], p[N], vis[N];
int get(int i, int x) {
  int j = lower_bound(b + 1, b + 1 + m, x) - b - 1;
  return vis[j] = 1, ans[i] = b[j];
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read(), f[i] = oo;
  ++n, a[n] = f[n] = oo;
  m = read();
  for (int i = 1; i <= m; ++i) b[i] = read();
  sort(b + 1, b + 1 + m);
  for (int i = 1; i <= n; ++i)
    if (~a[i]) {
      int j = lower_bound(f + 1, f + 1 + n, a[i]) - f - 1;
      l[i] = j + 1, f[j + 1] = a[i], p[i] = g[j], g[j + 1] = i;
    } else
      for (int j = n, k = m; k; f[j + 1] = b[k], g[j + 1] = i, --k)
        for (; f[j] >= b[k]; --j)
          ;
  for (int i = l[n], j = n, x = a[n]; i; --i)
    if (~a[j])
      ~a[p[j]] ? x = a[p[j]] : x = get(p[j], x), j = p[j];
    else {
      bool flg = false;
      for (int k = j - 1; k && !flg; --k)
        if (~a[k] && l[k] == i - 1 && a[k] < x) x = a[j = k], flg = true;
      for (int k = j - 1; k && !flg; --k)
        if (!~a[k]) x = get(j = k, x), flg = true;
    }
  for (int i = 1; i < n; ++i)
    if (ans[i]) a[i] = ans[i];
  for (int i = 1, j = 1; i < n; ++i)
    if (!~a[i]) {
      for (; vis[j]; ++j)
        ;
      vis[j] = 1, a[i] = b[j];
    }
  for (int i = 1; i < n; ++i) printf("%d ", a[i]);
  puts("");
  return 0;
}
