#include <bits/stdc++.h>
using namespace std;
int N;
priority_queue<int> Q;
set<pair<int, int> > B;
int result[200123];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    Q.push(tmp);
  }
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    B.insert(make_pair(tmp, i));
  }
  for (auto pB = B.begin(); pB != B.end(); ++pB) {
    int a = Q.top();
    Q.pop();
    result[(*pB).second] = a;
  }
  for (int i = 0; i < N; ++i) {
    if (i > 0) cout << " ";
    cout << result[i];
  }
  cout << endl;
}
