#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<pair<int, int> > B(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.rbegin(), A.rend());
  sort(B.begin(), B.end());
  vector<int> ans(N);
  for (int i = 0; i < N; ++i) {
    ans[B[i].second] = A[i];
  }
  for (auto el : ans) {
    cout << el << ' ';
  }
  cout << endl;
}
