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