#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 0x3f3f3f3f;
int n, m, a[N], b[N], f[N], g[N], l[N], p[N], v[N], ans[N];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
void get(int i, int k, int &x) {
  int o = lower_bound(b + 1, b + m + 1, k) - b - 1;
  v[o] = 1;
  x = ans[i] = b[o];
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read(), f[i] = inf;
  n++;
  a[n] = f[n] = inf;
  m = read();
  for (int i = 1; i <= m; i++) b[i] = read();
  sort(b + 1, b + m + 1);
  for (int i = 1; i <= n; i++)
    if (a[i] != -1) {
      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, o = m; o >= 1; o--) {
        while (f[j] >= b[o]) j--;
        f[j + 1] = b[o];
        g[j + 1] = i;
      }
    }
  int i = l[n], j = n, x = a[n];
  while (i-- > 0) {
    if (a[j] != -1) {
      if (a[p[j]] == -1)
        get(p[j], a[j], x);
      else
        x = a[p[j]];
      j = p[j];
    } else {
      int flag = 0;
      for (int s = j - 1; s >= 1; s--)
        if (a[s] != -1 && l[s] == i && a[s] < x) {
          x = a[j = s];
          flag = 1;
          break;
        }
      if (flag) continue;
      for (int s = j - 1; s >= 1; s--)
        if (a[s] == -1) {
          get(s, x, x);
          j = s;
          break;
        }
    }
  }
  for (int i = 1, j = 1; i <= n; i++) {
    if (a[i] == -1) {
      if (ans[i]) continue;
      while (v[j]) j++;
      v[j] = 1;
      ans[i] = b[j];
    } else
      ans[i] = a[i];
  }
  for (int i = 1; i < n; i++) printf("%d ", ans[i]);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
