#include <iostream>
using namespace std;
int SeuraavaVapaa(int i, int i2, int* inuse, int amount);
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(0);
int amount = 0;
cin >> amount;
int* uolevi = new int[amount];
int* maija = new int[amount];
int* kaaleppi = new int[amount];
int* inuse = new int[amount];
memset(inuse, -1, amount*sizeof(int));
for(int i = 0; i < amount; i++)
cin >> uolevi[i];
for(int i = 0; i < amount; i++)
cin >> maija[i];
for(int i = 0; i < amount; i++) {
int next = SeuraavaVapaa(uolevi[i], maija[i], inuse, amount);
kaaleppi[i] = next;
inuse[next] = i;
}
for(int i = 0; i < amount; i++) {
cout << kaaleppi[i] << " ";
}
return 0;
}
int SeuraavaVapaa(int i, int i2, int* inuse, int amount) {
for(int i3 = 0; i3 < amount; i3++) {
if(i3 == i || i3 == i2) continue;
if(inuse[i3] == -1)
return i3;
}
return -1;
}