#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a, b;
vector<int> ans;
int main() {
  int N;
  scanf("%d", &N);
  a.resize(N + 1), b.resize(N + 1);
  for (int i = 1, t; i <= N; i++) {
    scanf("%d", &t);
    a[i] = {t, i};
  }
  for (int i = 1, t; i <= N; i++) {
    scanf("%d", &t);
    b[i] = {t, i};
  }
  sort(a.begin() + 1, a.end());
  reverse(a.begin() + 1, a.end());
  sort(b.begin() + 1, b.end());
  ans.resize(N + 1);
  for (int i = 1; i <= N; i++) {
    ans[b[i].second] = a[i].first;
  }
  for (int i = 1; i <= N; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
