#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cout.tie(0);
  int n, a[200001], c[200001], valore;
  vector<pair<int, int>> v;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> valore;
    v.push_back(make_pair(valore, i));
  }
  sort(a, a + n, greater<int>());
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) c[v[i].second] = a[i];
  for (int i = 0; i < n; i++) cout << c[i] << " ";
  return 0;
}
