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