#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 200005;
int A[kMaxN], B[kMaxN], O[kMaxN];
int ans[kMaxN];
bool cmp(int a, int b) { return B[a] < B[b]; }
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%d", &A[i]);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &B[i]);
    O[i] = i;
  }
  sort(A, A + N);
  stable_sort(O, O + N, cmp);
  for (int i = 0; i < N; ++i) {
    ans[O[i]] = A[N - i - 1];
  }
  for (int i = 0; i < N; ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
