#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > b;
vector<int> A;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  A = vector<int>(n);
  b = vector<pair<int, int> >(n);
  vector<int> ans(n);
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(A.begin(), A.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    int id = b[i].second;
    ans[id] = A[n - i - 1];
  }
  for (int i = 0; i < n; i++) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
