#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int A[MAXN + 5], f[MAXN + 5];
struct node {
  int x, c;
} B[MAXN + 5];
int M;
bool cmp(node a, node b) { return a.x > b.x; }
int main() {
  scanf("%d", &M);
  for (int i = 1; i <= M; i++) scanf("%d", &A[i]);
  for (int i = 1; i <= M; i++) {
    scanf("%d", &B[i].x);
    B[i].c = i;
  }
  stable_sort(B + 1, B + 1 + M, cmp);
  stable_sort(A + 1, A + 1 + M);
  for (int i = 1; i <= M; i++) {
    int tot = B[i].c;
    f[tot] = A[i];
  }
  for (int i = 1; i <= M; i++) printf("%d%c", f[i], i == M ? '\n' : ' ');
}
