#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, temp;
  cin >> m;
  vector<int> a(m);
  vector<pair<int, int> > b(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b.begin(), b.end());
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < m; i++) b[i].first = a[i];
  for (int i = 0; i < m; i++) {
    temp = b[i].first;
    b[i].first = b[i].second;
    b[i].second = temp;
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < m; i++) cout << b[i].second << " ";
  cout << endl;
  return 0;
}
