#include <bits/stdc++.h>
using namespace std;
struct vec {
  long long x, id;
} a[2 * 100000 + 17], b[2 * 100000 + 17];
bool cmp(vec c, vec d) { return c.x < d.x; }
bool cmp1(vec c, vec d) { return c.id < d.id; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].x;
    a[i].id = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i].x;
    b[i].id = i;
  }
  sort(a, a + n, cmp);
  sort(b, b + n, cmp);
  for (int i = 0; i < n; i++) b[i].x = a[n - i - 1].x;
  sort(b, b + n, cmp1);
  for (int i = 0; i < n; i++) cout << b[i].x << ' ';
  return 0;
}
