#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long b[n], aux[n], r;
  std::vector<pair<long long, int> > a;
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> r;
    a.push_back(make_pair(r, i));
  }
  sort(a.begin(), a.end());
  sort(b, b + n);
  int cd = n - 1;
  for (int i = 0; i < n; ++i) {
    aux[a[i].second] = b[cd];
    cd--;
  }
  for (int i = 0; i < n; ++i) {
    cout << aux[i];
    if (i != n - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
