#include <bits/stdc++.h>
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
struct node {
  int pos, key, change;
} a[220000], b[220000];
inline bool cmp1(node a, node b) { return a.key < b.key; }
inline bool cmp2(node a, node b) { return a.key > b.key; }
inline bool cmp3(node a, node b) { return a.pos < b.pos; }
int m;
int main() {
  m = read();
  for (int i = 1; i <= m; ++i) a[i].key = read(), a[i].pos = i;
  for (int i = 1; i <= m; ++i) b[i].key = read(), b[i].pos = i;
  std::sort(a + 1, a + m + 1, cmp1);
  std::sort(b + 1, b + m + 1, cmp2);
  for (int i = 1; i <= m; ++i) b[i].change = a[i].key;
  std::sort(b + 1, b + m + 1, cmp3);
  for (int i = 1; i <= m; ++i) printf("%d ", b[i].change);
  return 0;
}
