#include <bits/stdc++.h>
using namespace std;
int N;
int A[200005];
pair<int, int> B[200005];
int Res[200005];
void Read() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 1; i <= N; i++) cin >> B[i].first, B[i].second = i;
  sort(B + 1, B + N + 1);
  sort(A + 1, A + N + 1);
  for (int i = 1; i <= N; i++) {
    Res[B[N - i + 1].second] = A[i];
  }
  for (int i = 1; i <= N; i++) cout << Res[i] << " ";
  cout << "\n";
}
int main() {
  Read();
  return 0;
}
