#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
inline void write(int x) {
  if (x == 0) {
    putchar('0');
    return;
  }
  char F[200];
  int tmp = x > 0 ? x : -x, cnt = 0;
  if (x < 0) putchar('-');
  while (tmp > 0) F[cnt++] = tmp % 10 + '0', tmp /= 10;
  while (cnt > 0) putchar(F[--cnt]);
}
const int N = 2e5 + 5;
struct node {
  int x, id;
} b[N];
int n, a[N], ans[N];
bool cmp(int x, int y) { return x > y; }
bool cmp1(node x, node y) { return x.x < y.x; }
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) b[i].x = read(), b[i].id = i;
  sort(a + 1, a + 1 + n, cmp);
  sort(b + 1, b + 1 + n, cmp1);
  for (int i = 1; i <= n; i++) ans[b[i].id] = a[i];
  for (int i = 1; i <= n; i++) write(ans[i]), putchar(' ');
  return 0;
}
