#include <bits/stdc++.h>
using namespace std;
bool sec(pair<signed long long, signed long long> a,
         pair<signed long long, signed long long> b) {
  return (a.second < b.second);
}
int main() {
  std::ios::sync_with_stdio(false);
  signed long long n;
  cin >> n;
  vector<pair<signed long long, signed long long>> v;
  signed long long a[n + 2];
  for (signed long long i = 0; i < n; i++) cin >> a[i];
  for (signed long long i = 0; i < n; i++) {
    signed long long x;
    cin >> x;
    v.push_back({x, i});
  }
  sort(v.begin(), v.end());
  sort(a, a + n, greater<signed long long>());
  for (signed long long i = 0; i < n; i++) v[i].first = a[i];
  sort(v.begin(), v.end(), sec);
  for (signed long long i = 0; i < n; i++) cout << v[i].first << " ";
  cout << endl;
  return 0;
}
