#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, k, l, r, x, y, l1, l2, ans[200001], a[200001];
struct node {
  int id, x;
} b[200001];
bool cmp(int x, int y) { return x > y; }
bool cmp1(node x, node y) { return x.x < y.x; }
inline int read() {
  char c = getchar();
  bool f = 0;
  int x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
signed 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 + n + 1, cmp);
  sort(b + 1, b + n + 1, cmp1);
  for (int i = 1; i <= n; i++) ans[b[i].id] = a[i];
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
}
