#include <bits/stdc++.h>
using namespace std;
int A[200004], B[200004];
pair<int, int> V[200004];
int N;
int main() {
  scanf("%d\n", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &B[i]);
    V[i] = {B[i], i};
  }
  sort(V + 1, V + 1 + N);
  sort(A + 1, A + 1 + N);
  for (int i = 1; i <= N; ++i) {
    B[V[i].second] = A[N - i + 1];
  }
  for (int i = 1; i <= N; ++i) {
    cout << B[i] << ' ';
  }
  cout << '\n';
  return 0;
}
