#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int sum[N];
int a[N], b[N];
int dp[N];
int stk[N];
int pre[N];
int last[N];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 2; i <= n + 1; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + (a[i] == -1);
  }
  a[n + 2] = 0x3f3f3f3f;
  sum[n + 2] = sum[n + 1];
  n += 2;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
  }
  sort(b + 1, b + m + 1);
  m = unique(b + 1, b + m + 1) - b - 1;
  stk[1] = 0;
  dp[1] = 1;
  last[1] = 1;
  for (int i = 2; i <= n; i++) stk[i] = 0x7fffffff;
  for (int i = 2; i <= n; i++) {
    if (a[i] != -1) {
      int pos = 1, lt = 1, rt = n, mid;
      while (lt <= rt) {
        mid = (lt + rt) / 2;
        if (stk[mid] < a[i]) {
          pos = mid;
          lt = mid + 1;
        } else
          rt = mid - 1;
      }
      pre[i] = last[pos];
      last[pos + 1] = i;
      dp[i] = pos + 1;
      stk[pos + 1] = a[i];
    } else {
      pre[i] = dp[i] = -1;
      for (int j = m, k = n; j >= 1; j--) {
        while (stk[k] >= b[j]) k--;
        stk[k + 1] = b[j];
        last[k + 1] = -1;
      }
    }
  }
  int left = m;
  for (int i = n; i >= 1;) {
    if (a[i] == -1) continue;
    if (pre[i] >= 0) {
      i = pre[i];
      continue;
    }
    int r = lower_bound(b + 1, b + left + 1, a[i]) - b - 1;
    for (int j = i - 1; j >= 1; j--) {
      if (a[j] == -1 || a[j] >= a[i]) continue;
      int l = upper_bound(b + 1, b + left + 1, a[j]) - b;
      if (dp[i] - dp[j] - 1 == min(r - l + 1, sum[i] - sum[j])) {
        left = l - 1;
        for (int k = j + 1; l <= r && k < i; k++)
          if (a[k] == -1) {
            a[k] = b[l];
            b[l++] = -1;
          }
        i = j;
        break;
      }
    }
  }
  for (int i = 1, j = 1; i <= n; i++)
    if (a[i] == -1) {
      while (b[j] == -1) j++;
      a[i] = b[j];
      b[j++] = -1;
    }
  for (int i = 2; i < n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
