#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first < b.first) {
    return true;
  } else if (a.first > b.first) {
    return false;
  } else {
    if (a.second > b.second) {
      return true;
    } else {
      return false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int m;
  cin >> m;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  pair<int, int> b[m];
  int tmp;
  for (int i = 0; i < m; i++) {
    cin >> tmp;
    b[i] = make_pair(tmp, i);
  }
  sort(a, a + m);
  sort(b, b + m, compare);
  map<int, pair<int, int> > mymap;
  for (int i = 0; i < m; i++) {
    mymap[b[i].second] = make_pair(b[i].first, a[m - i - 1]);
  }
  map<int, pair<int, int> >::iterator it;
  for (it = mymap.begin(); it != mymap.end(); it++) {
    cout << it->second.second << " ";
  }
  cout << endl;
  return 0;
}
