#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  vector<int> V1;
  vector<pair<int, int>> V2;
  for (int i = 0; i < N; i++) {
    int X;
    cin >> X;
    V1.push_back(X);
  }
  for (int i = 0; i < N; i++) {
    int X;
    cin >> X;
    V2.push_back({X, i});
  }
  sort(V2.begin(), V2.end());
  for (int i = 0; i < N; i++) {
    int Ans = 0;
    int L = 0, R = N - 1;
    while (R >= L) {
      int M = L + (R - L) / 2;
      if (V2[M].first > V1[i]) {
        R = M - 1;
      } else if (V2[M].first < V1[i]) {
        L = M + 1;
      } else {
        Ans = V2[M].second;
        break;
      }
    }
    cout << V1[Ans] << " ";
  }
  return 0;
}
