#include <bits/stdc++.h>
using namespace std;
struct number {
  int num;
  int id;
} c[200100];
bool cmp1(number a, number b) { return a.num < b.num; }
bool cmp2(int a, int b) { return a > b; }
int a[200100], b[200100];
int main() {
  int n;
  int i;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) {
    scanf("%d", &c[i].num);
    c[i].id = i;
  }
  sort(c, c + n, cmp1);
  sort(a, a + n, cmp2);
  for (i = 0; i < n; i++) {
    b[c[i].id] = a[i];
  }
  for (i = 0; i < n; i++) {
    printf("%d", b[i]);
    if (i != n - 1) printf(" ");
  }
  printf("\n");
  return 0;
}
