#include <bits/stdc++.h>
using namespace std;
const int nmax = 2e5 + 5;
int n;
int a[nmax];
int b[nmax];
int main() {
  vector<pair<int, int> > s;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    s.push_back({b[i], i});
  }
  sort(s.begin(), s.end());
  reverse(s.begin(), s.end());
  sort(a + 1, a + n + 1);
  for (int i = 0; i < n; i++) {
    b[s[i].second] = a[i + 1];
  }
  for (int i = 1; i <= n; i++) {
    cout << b[i] << ' ';
  }
  cout << '\n';
  return 0;
}
