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