#include <bits/stdc++.h>
using namespace std;
int ans[2111111];
int main() {
  int m;
  cin >> m;
  priority_queue<int> q1;
  for (int i = 0; i < m; i++) {
    int temp;
    cin >> temp;
    q1.push(temp);
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q2;
  for (int i = 0; i < m; i++) {
    int temp;
    cin >> temp;
    q2.push({temp, i});
  }
  while (!q1.empty()) {
    int a1 = q1.top();
    pair<int, int> a2 = q2.top();
    ans[a2.second] = a1;
    q1.pop();
    q2.pop();
  }
  for (int i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}
