#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, x, arr[200005];
  vector<int> a;
  vector<pair<int, int> > b;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    a.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    b.push_back(make_pair(x, i));
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < m; i++) {
    arr[b[i].second] = a[m - 1 - i];
  }
  for (int i = 0; i < m; i++) cout << arr[i] << " ";
  cout << "\n";
  return 0;
}
