#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<pair<int, int> > p(n);
  for (int &t : a) scanf("%d", &t);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i].first);
    p[i].second = i;
  }
  sort(a.begin(), a.end());
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    x[p[i].second] = a[i];
  }
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", x[i]);
  }
  puts("");
}
