#include <bits/stdc++.h>
using namespace std;
int main() {
  int iTam;
  cin >> iTam;
  long long arr1[iTam], arr2[iTam];
  pair<int, int> arrb[iTam];
  for (int i = 0; i < iTam; i++) cin >> arr1[i];
  for (int i = 0; i < iTam; i++) {
    cin >> arrb[i].first;
    arrb[i].second = i;
  }
  sort(arr1, arr1 + iTam, greater<int>());
  sort(arrb, arrb + iTam);
  for (int i = 0; i < iTam; i++) {
    arr2[arrb[i].second] = arr1[i];
  }
  for (int i = 0; i < iTam; i++) cout << arr2[i] << " ";
  return 0;
}
