#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m;
  cin >> m;
  vector<pair<long long, long long> > a(m), b(m);
  for (long long i = 0; i < m; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (long long i = 0; i < m; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a.rbegin(), a.rend());
  sort(b.begin(), b.end());
  vector<long long> answ(m);
  for (long long i = 0; i < m; i++) {
    answ[b[i].second] = a[i].first;
  }
  for (auto &x : answ) cout << x << " ";
  cin >> m;
  return 0;
}
