#include <bits/stdc++.h>
using namespace std;
int n;
int a[200100], b[200100], w[200100], ans[200100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  sort(a + 1, a + n + 1);
  for (int j = 1; j <= n; ++j) scanf("%d", b + j), w[j] = j;
  sort(w + 1, w + n + 1, [](int i, int j) { return b[i] > b[j]; });
  for (int i = 1; i <= n; ++i) ans[w[i]] = a[i];
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
