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