#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  vector<pair<int, int>> vv(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    scanf("%d", &vv[i].first);
    vv[i].second = i;
  }
  sort(vv.begin(), vv.end());
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[vv[i].second] = v[i];
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << "\n";
}
