#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = -1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
  return x;
}
inline void chkmin(int &a, int b) {
  if (a > b) a = b;
}
inline void chkmax(int &a, int b) {
  if (a < b) a = b;
}
inline int minn(int a, int b) {
  if (a < b) return a;
  return b;
}
inline int maxx(int a, int b) {
  if (a > b) return a;
  return b;
}
const int N = 2e5 + 9;
struct node {
  int id, b;
  bool operator<(node q) const { return b < q.b; }
} e[N];
bool cmp(node a, node b) { return a.id < b.id; }
int a[N], b[N];
int ans[N];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) e[i].b = read(), e[i].id = i;
  sort(e + 1, e + n + 1);
  for (int i = 1; i <= n; i++) e[i].b = a[n - i + 1];
  sort(e + 1, e + n + 1, cmp);
  for (int i = 1; i <= n; i++) printf("%d%c", e[i].b, " \n"[i == n]);
  return 0;
}
