#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N], b[N], c[N], ans[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  sort(a, a + n, greater<int>());
  for (int i = 0; i < n; ++i) c[i] = i;
  sort(c, c + n, [&](int i, int j) { return b[i] < b[j]; });
  for (int i = 0; i < n; ++i) ans[c[i]] = a[i];
  for (int i = 0; i < n; ++i) printf("%d%c", ans[i], " \n"[i == n - 1]);
}
