#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
//using namespace std;
inline void readToArray(unsigned long n, unsigned long* ptr){
for (unsigned long i = 0; i < n; i++){
std::cin >> ptr[i];
}
}
int main() {
std::cin.sync_with_stdio(false);//Faster execution
unsigned long n;
std::cin >> n;
unsigned long* uolevinJarjestys = new unsigned long[n];
unsigned long* maijanJarjestys = new unsigned long[n];
readToArray(n, uolevinJarjestys);
readToArray(n, maijanJarjestys);
unsigned long* num = new unsigned long[n];
for (unsigned long i = 0; i<n; i++){
num[i] = 0;
}
std::vector < unsigned long >toTry;
for (unsigned long i = 1; i <= n; i++){
toTry.push_back(i);
}
//Etsi lukujono, joka on välillä 0<num[x]<n && num[x] != uolevinJärjestys[x] && num[x] != maijanJärjestys[x]
for (unsigned long i = 0; i < n; i++){
unsigned int z = 0;
unsigned long x = toTry.at(z);
while (x == uolevinJarjestys[i] || x == maijanJarjestys[i]){
z++;
x = toTry.at(z);
}
//Remove used entry from the list
//toTry.erase(toTry.begin()+z);
toTry.erase(std::remove(toTry.begin(), toTry.end(), z), toTry.end());
num[i] = x;
}
for (unsigned long i = 0; i < n; i++){
std::cout << num[i] << ' ';
}
//std::cout << sstm.str() << std::endl;
//delete[] num;
//delete[] uolevinJarjestys;
//delete[] maijanJarjestys;
return 0;
}