func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   bool taken[1001];   int a[1001], b[1001], ans[1001];   vector<int> problem;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> a[i];     }     for (int i = 0; i < n; ++i) {       cin >> b[i];       if (b[i] == a[i])         ans[i] = b[i], taken[a[i]] = true;       else         problem.push_back(i);     }     if (problem.size() == 1) {       for (int i = 1; i <= n; ++i) {         if (!taken[i]) {           ans[problem[0]] = i;           break;         }       }     } else {       vector<int> possible[2];       for (int i = 1; i <= n; ++i) {         if (!taken[i]) {           if (a[problem[0]] == i || b[problem[0]] == i) possible[0].push_back(i);           if (a[problem[1]] == i || b[problem[1]] == i) possible[1].push_back(i);         }       }       if (possible[0].size() == possible[1].size()) {         if (possible[0].size() == 1) {           ans[problem[0]] = possible[0][0];           ans[problem[1]] = possible[1][0];         } else {           ans[problem[0]] = possible[0][0];           ans[problem[1]] = possible[1][1];         }       } else {         if (possible[0].size() == 1) {           ans[problem[0]] = possible[0][0];           ans[problem[1]] = (possible[0][0] == possible[1][0] ? possible[1][1]                                                               : possible[1][0]);         } else {           ans[problem[0]] = (possible[1][0] == possible[0][0] ? possible[0][1]                                                               : possible[0][0]);           ans[problem[1]] = possible[1][0];         }       }     }     for (int i = 0; i < n; ++i) {       cout << ans[i] <<    ;     }     cout << endl;     return 0;   }   