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