#include <bits/stdc++.h>
using namespace std;
int a[500005], n, c[500005];
struct Node {
  int x, id;
} b[500005];
bool cmp(Node aa, Node bb) { return aa.x > bb.x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i].x), b[i].id = i;
  sort(b + 1, b + n + 1, cmp);
  for (int i = 1; i <= n; i++) c[b[i].id] = a[i];
  for (int i = 1; i < n; i++) printf("%d ", c[i]);
  printf("%d", c[n]);
  return 0;
}
