#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x = Sub(x - y); }
inline int Mul(int x, int y) { return (int)((unsigned long long)x * y % mod); }
inline int Mul(int x, int y, int z) {
  return (int)((unsigned long long)x * y % mod * z % mod);
}
int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}
int Fix(int x) { return Sub(x % mod); }
int Inv(int x) { return Pow(x, mod - 2); }
template <class T>
inline void Max(T &x, T y) {
  if (y > x) x = y;
}
template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}
const int maxn = 1e5, inf = ~0U >> 2;
int n, N, m, A[maxn + 2], A0[maxn + 2], B[maxn];
map<int, int> use;
int least[maxn + 3], l_who[maxn + 3];
int len[maxn + 2], last[maxn + 2];
int L[maxn + 2], R[maxn + 2];
int s_gap[maxn + 3];
void InitLR(void) {
  s_gap[0] = 0;
  for (int i = 0; i < N; ++i) {
    int x = A[i];
    s_gap[i + 1] = s_gap[i] + (x == -1);
    if (x == -1) continue;
    L[i] = (int)(upper_bound(B, B + m, x) - B);
    R[i] = (int)(lower_bound(B, B + m, x) - B - 1);
  }
}
inline int Count(int i, int j) { return R[j] - L[i] + 1; }
void Solve(void) {
  N = n + 2;
  least[0] = least[1] = A[0];
  l_who[0] = l_who[1] = 0;
  len[0] = 1;
  fill(least + 2, least + N + 1, inf);
  for (int i = 1; i < N; ++i) {
    if (A[i] != -1) {
      int d = (int)(lower_bound(least, least + N + 1, A[i]) - least);
      len[i] = d;
      last[i] = l_who[d - 1];
      least[d] = A[i];
      l_who[d] = i;
    } else {
      for (int j = m - 1, d = N; j >= 0; --j) {
        while (d > 0 && least[d - 1] >= B[j]) --d;
        least[d] = B[j];
        l_who[d] = -1;
      }
    }
  }
  InitLR();
  int pos = N - 1;
  while (pos > 0) {
    int pos_last = last[pos];
    if (pos_last != -1) {
      pos = pos_last;
      continue;
    }
    for (int i = 0; i < pos; ++i) {
      if (A[i] != -1 && A[i] < A[pos]) {
        int c_val = Count(i, pos), c_gap = s_gap[pos] - s_gap[i];
        if (L[i] <= R[pos] && min(c_val, c_gap) + 1 + len[i] == len[pos]) {
          int cur = L[i];
          for (int j = i + 1; j < pos; ++j) {
            if (A[j] == -1) {
              assert(cur >= L[i] && cur <= R[pos]);
              A[j] = B[cur++];
              if (cur > R[pos]) break;
            }
          }
          pos = i;
          break;
        }
      }
    }
  }
}
int Any(void) {
  auto x = use.begin();
  if (x->second == 0) {
    use.erase(x);
    return Any();
  }
  --x->second;
  return x->first;
}
int main(void) {
  scanf("%d", &n);
  A[0] = -2;
  A[n + 1] = inf - 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", A + i);
  }
  memcpy((A0), (A), sizeof((A)[0]) * (n + 2));
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", B + i);
    use[B[i]] += 1;
  }
  sort(B, B + m);
  m = (int)(unique(B, B + m) - B);
  Solve();
  for (int i = 1; i <= n; ++i) {
    if (A[i] != -1 && A0[i] == -1) {
      use[A[i]] -= 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (A[i] == -1) {
      A[i] = Any();
    }
    printf("%d%c", A[i], " \n"[i == n]);
  }
  return 0;
}
