#include <bits/stdc++.h>
const int Inf = 1000000012;
using namespace std;
vector<int> gaps_m[1000];
vector<int> gaps_p[1000];
int a[100002];
int gap_numbers[100002];
int d[100002];
int par[100002];
int prv[100002];
char used[100002];
int main() {
  int n, k;
  scanf(" %d", &n);
  for (int i = 0; i < n; ++i) scanf(" %d", &(a[i]));
  scanf(" %d", &k);
  for (int i = 0; i < k; ++i) {
    scanf(" %d", &(gap_numbers[i]));
  }
  sort(gap_numbers, gap_numbers + k);
  for (int i = 0; i <= n; ++i) d[i] = Inf;
  par[0] = -1;
  prv[0] = -1;
  d[0] = -1;
  int maxd = 0;
  int kg = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] != -1) {
      int j = int(upper_bound(d, d + n + 1, a[i]) - d);
      if (d[j - 1] < a[i] && a[i] < d[j]) {
        d[j] = a[i];
        par[j] = i;
        prv[i] = par[j - 1];
        if (j > maxd) maxd = j;
      }
    } else {
      prv[i] = kg;
      int gi = k - 1;
      int di = maxd + 1;
      while ((di >= 1) && (gi >= 0)) {
        bool f = false;
        while ((gi >= 0) && (gap_numbers[gi] >= d[di])) --gi;
        while ((gi >= 0) &&
               (d[di - 1] < gap_numbers[gi] && gap_numbers[gi] < d[di])) {
          --gi;
          f = true;
        }
        if (f) {
          gi = gi + 1;
          if (d[di - 1] < gap_numbers[gi] && gap_numbers[gi] < d[di]) {
            d[di] = gap_numbers[gi];
            par[di] = i;
            gaps_m[kg].push_back(di);
            gaps_p[kg].push_back(par[di - 1]);
            if (di > maxd) maxd = di;
          }
        }
        --di;
      }
      ++kg;
    }
  }
  int m = n;
  while (d[m] == Inf) --m;
  memset(used, 0, sizeof(used));
  int q = k - 1;
  if (m > 0) {
    int c = par[m];
    int last = Inf;
    while (c >= 0) {
      if (a[c] == -1) {
        while (gap_numbers[q] >= last) --q;
        used[q] = 1;
        a[c] = gap_numbers[q];
        --q;
        last = a[c];
        int t = gaps_m[prv[c]].size() - 1;
        while (gaps_m[prv[c]][t] != m) --t;
        c = gaps_p[prv[c]][t];
      } else {
        last = a[c];
        c = prv[c];
      }
      --m;
    }
  }
  q = 0;
  for (int i = 0; i < n; ++i)
    if (a[i] == -1) {
      while (used[q]) ++q;
      a[i] = gap_numbers[q];
      used[q] = 1;
    }
  printf("%d", a[0]);
  for (int i = 1; i < n; ++i) printf(" %d", a[i]);
  printf("\n");
  return 0;
}
