#include <bits/stdc++.h>
using namespace std;
bool pairCompareByFirst(const std::pair<int, int>& firstElem,
                        const std::pair<int, int>& secondElem) {
  return firstElem.first < secondElem.first;
}
bool pairCompareBySecond(const std::pair<int, int>& firstElem,
                         const std::pair<int, int>& secondElem) {
  return firstElem.second < secondElem.second;
}
int main() {
  int m;
  cin >> m;
  vector<pair<int, int> > a, b;
  int t;
  for (int i = 0; i < m; i++) {
    scanf("%i", &t);
    a.push_back(make_pair(t, i));
  }
  for (int i = 0; i < m; i++) {
    scanf("%i", &t);
    b.push_back(make_pair(t, i));
  }
  sort(a.begin(), a.end(), pairCompareByFirst);
  sort(b.begin(), b.end(), pairCompareByFirst);
  for (int i = 0; i < m; i++) {
    b[i].first = a[m - 1 - i].first;
  }
  sort(b.begin(), b.end(), pairCompareBySecond);
  for (int i = 0; i < m; i++) {
    printf("%i ", b[i]);
  }
  return 0;
}
