#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[1005];
  int c[1005];
  memset(c, 0, sizeof c);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c[a[i]]++;
  }
  int ans[1005];
  memset(ans, 0, sizeof ans);
  for (int i = 0; i < n; i++)
    if (c[a[i]] == 1) ans[i] = a[i];
  memset(c, 0, sizeof c);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c[a[i]]++;
  }
  for (int i = 0; i < n; i++)
    if (c[a[i]] == 1) ans[i] = a[i];
  memset(c, 0, sizeof c);
  for (int i = 0; i < n; i++) c[ans[i]]++;
  int j = 1;
  for (int i = 0; i < n; i++) {
    if (ans[i] == 0) {
      while (c[j]) ++j;
      ans[i] = j;
      j++;
    }
    cout << ans[i] << " ";
  }
  return 0;
}
