#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
int main() {
  long long n;
  vector<long long> a;
  vector<pair<long long, long long> > b;
  cin >> n;
  for (int i = int(0); i < int(n); i++) {
    long long aux;
    cin >> aux;
    a.push_back(aux);
  }
  for (int i = int(0); i < int(n); i++) {
    long long aux;
    cin >> aux;
    b.push_back(make_pair(aux, i));
  }
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  sort(a.begin(), a.end());
  for (int i = int(0); i < int(n); i++) {
    b[i].first = a[i];
  }
  sort(b.begin(), b.end(), sortbysec);
  for (int i = int(0); i < int(n); i++) {
    cout << b[i].first << " ";
  }
  return 0;
}
