#include <bits/stdc++.h>
using namespace std;
bool f(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  ios::sync_with_stdio(false);
  int m, a[200000];
  pair<int, int> b[200000];
  cin >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    int aux;
    cin >> aux;
    b[i] = make_pair(aux, i);
  }
  sort(a, a + m);
  sort(b, b + m, f);
  int ans[200000];
  for (int i = m - 1; i >= 0; i--) ans[b[m - i - 1].second] = a[i];
  for (int i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}
