#include <bits/stdc++.h>
using namespace std;
int n, a[200500], b[200500], ans[200500];
vector<pair<int, int> > vec;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n, greater<int>());
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    vec.push_back({b[i], i});
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    ans[vec[i].second] = a[i];
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
