#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  int m;
  cin >> m;
  vector<int> a(m);
  vector<pair<int, int>> b(m);
  for (int i = 0; i < m; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &b[i].first);
    b[i].second = i + 1;
  }
  sort(a.rbegin(), a.rend());
  sort(b.begin(), b.end());
  for (int i = 0; i < m; ++i) b[i].first = a[i];
  sort(b.begin(), b.end(), cmp);
  for (auto elem : b) cout << elem.first << " ";
  cout << endl;
  return 0;
}
