#include <bits/stdc++.h>
int a[200000], b[200000], rez[200000];
int* p[200000];
struct per {
  int v, *p;
} v[200000];
bool cmp1(int a, int b) { return a > b; }
bool cmp2(per a, per b) { return a.v < b.v; }
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", &v[i].v);
    v[i].p = &rez[i];
  }
  std::sort(a, a + n, cmp1);
  std::sort(v, v + n, cmp2);
  for (int i = 0; i < n; ++i) *v[i].p = a[i];
  for (int i = 0; i < n; ++i) printf("%d ", rez[i]);
  return 0;
}
