#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  vector<pair<long long int, long long int>> v;
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
    v.push_back({b[i], i});
  }
  sort(v.begin(), v.end());
  sort(a, a + n, greater<long long int>());
  long long int ans[n];
  for (long long int i = 0; i < n; i++) {
    ans[v[i].second] = a[i];
  }
  for (long long int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
