#include <bits/stdc++.h>
using namespace std;
vector<int> taba;
multimap<int, int> link;
int rez[200001];
int main() {
  int m, in;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> in;
    taba.push_back(in);
  }
  for (int i = 1; i <= m; i++) {
    cin >> in;
    link.insert(make_pair(in, i));
  }
  sort(taba.begin(), taba.end());
  int k = 1;
  for (multimap<int, int>::iterator it = link.begin(); it != link.end(); it++) {
    rez[(*it).second] = taba[m - k];
    k++;
  }
  for (int i = 1; i <= m; i++) {
    cout << rez[i] << " ";
  }
  return 0;
}
