#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long A[200005], B[200005], D[200005];
  pair<long long, int> C[200005];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> B[i];
    C[i] = make_pair(B[i], i);
  }
  sort(C, C + n);
  sort(A, A + n, greater<long long>());
  for (int i = 0; i < n; i++) {
    D[C[i].second] = A[i];
  }
  for (int i = 0; i < n; i++) {
    cout << D[i] << " ";
  }
}
