#include <bits/stdc++.h>
using namespace std;
int n;
int a[200000];
int b[200000];
int oa[200000];
int ob[200000];
int ans[200000];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    oa[i] = ob[i] = i;
  }
  sort(oa, oa + n, [](int x, int y) { return a[x] < a[y]; });
  sort(ob, ob + n, [](int x, int y) { return b[x] > b[y]; });
  for (int i = 0; i < n; i++) ans[ob[i]] = a[oa[i]];
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  return 0;
}
