#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  for (int i = 0; i < n; i++) cin >> b[i].first, b[i].second = i;
  sort(a, a + n, greater<pair<int, int>>());
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    a[i].second = b[i].second;
  }
  sort(a, a + n,
       [](pair<int, int> a, pair<int, int> b) { return a.second < b.second; });
  for (int i = 0; i < n; i++) cout << a[i].first << ' ';
  return 0;
}
