#include <bits/stdc++.h>
using namespace std;
int n, a[200010], b[200010], nw[200010];
pair<int, int> P[200010];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    P[i].first = b[i];
    P[i].second = i;
  }
  sort(a, a + n);
  sort(P, P + n);
  for (int i = n - 1, j = 0; i >= 0; i--, j++) {
    nw[P[j].second] = a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << nw[i] << ' ';
  }
}
