#include <bits/stdc++.h>
using namespace std;
vector<int> a(200005);
vector<pair<int, int> > b(200005);
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second < b.second;
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b.begin(), b.begin() + n);
  sort(a.begin(), a.begin() + n, greater<int>());
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[b[i].second] = a[i];
  }
  for (auto i : ans) {
    cout << i << " ";
  }
  return 0;
}
