#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
using namespace std;
int n, h[101000];
int m, a[101000];
pair<int, int> f[101000];
int ftot;
int g[101000], pre[101000];
inline void work(int i) {
  if (h[i] == -1) {
    int ptr = ftot;
    for (int j = m; j; --j) {
      while (ptr && f[ptr].first >= a[j]) --ptr;
      if (ptr == ftot) ++ftot;
      f[ptr + 1] = make_pair(a[j], f[ptr].second);
    }
  } else {
    int p = lower_bound(f + 1, f + 1 + ftot, make_pair(h[i], -12341)) - f;
    if (p > ftot) ++ftot;
    g[i] = p;
    pre[i] = f[p - 1].second;
    f[p] = make_pair(h[i], i);
  }
}
bool vis[101000];
inline void get_ans() {
  int p = n + 1;
  pre[n + 1] = f[ftot].second;
  g[n + 1] = ftot + 1;
  while (p) {
    int pe = pre[p];
    int ptr = upper_bound(a + 1, a + m + 1, h[pe]) - a, c = g[p] - g[pe] - 1;
    for (int j = pe + 1; j < p; ++j)
      if (h[j] == -1) {
        if (!c) break;
        while (a[ptr] == a[ptr - 1]) ++ptr;
        if (vis[ptr]) puts("QAQ");
        h[j] = a[ptr];
        vis[ptr] = true;
        ++ptr;
        --c;
      }
    p = pe;
  }
  int ptr = 1;
  for (int i = 1; i <= n; ++i)
    if (h[i] == -1) {
      while (vis[ptr]) ++ptr;
      h[i] = a[ptr];
      vis[ptr] = true;
    }
  for (int i = 1; i <= n; ++i) printf("%d ", h[i]);
  puts("");
}
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) read(h[i]);
  read(m);
  for (int i = 1; i <= m; ++i) read(a[i]);
  sort(a + 1, a + 1 + m);
  for (int i = 1; i <= n; ++i) work(i);
  get_ans();
  return 0;
}
