#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "} ";
  return out;
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T>
istream &operator>>(istream &in, vector<T> &arr) {
  for (auto &i : arr) in >> i;
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &arr) {
  for (int i = 0; i < (int)arr.size(); ++i) {
    if (i != 0) {
      out << ' ';
    }
    out << arr[i];
  }
  out << endl;
  return out;
}
void get_ans(vector<int> &ans, vector<pair<int, int>> &b, vector<int> &a) {
  int n = ans.size();
  for (int i = 0; i < n; ++i) {
    ans[b[i].second] = a[n - i - 1];
  }
}
signed main() {
  int m;
  cin >> m;
  vector<int> a(m);
  vector<int> ans(m);
  vector<pair<int, int>> b(m);
  cin >> a;
  for (int i = 0; i < m; ++i) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  get_ans(ans, b, a);
  for (int i = 0; i < m; ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
