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