#include <bits/stdc++.h>
using namespace std;
vector<int> p;
vector<pair<int, int> > v, ans;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second > b.second;
  else
    return a.first < b.first;
}
int main() {
  int n;
  cin >> n;
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a;
    p.push_back(a);
  }
  for (int i = 0; i < n; i++) {
    cin >> b;
    v.push_back({b, i});
  }
  sort(p.begin(), p.end());
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < n; i++) {
    ans.push_back({v[i].second, p[n - i - 1]});
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < n; i++) cout << ans[i].second << " ";
  cout << endl;
  return 0;
}
