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