#include <bits/stdc++.h>
using namespace std;
void doRoutine() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
signed main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  sort(a.rbegin(), a.rend());
  vector<pair<int, int> > binds(n);
  for (int i = 0; i < n; ++i) {
    binds[i] = {b[i], i};
  }
  sort(binds.begin(), binds.end());
  vector<int> inds(n);
  for (int i = 0; i < n; ++i) {
    inds[i] = binds[i].second;
  }
  vector<int> res(n);
  for (int i = 0; i < n; ++i) {
    res[inds[i]] = a[i];
  }
  for (auto x : res) {
    cout << x << " ";
  }
  return 0;
}
