#include <bits/stdc++.h>
using namespace std;
inline int Read() {
  int x = 0, f = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 200005;
int n, a[MAXN], c[MAXN];
pair<int, int> b[MAXN];
int main() {
  n = Read();
  for (int i = 1; i <= n; i++) a[i] = Read();
  for (int i = 1; i <= n; i++) b[i] = make_pair(Read(), i);
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  reverse(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) c[b[i].second] = a[i];
  for (int i = 1; i <= n; i++) printf("%d%c", c[i], i == n ? '\n' : ' ');
}
