#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
int a[MAXN], ans[MAXN];
pair<int, int> tab[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> tab[i].first;
    tab[i].second = i;
  }
  sort(a, a + n, greater<int>());
  sort(tab, tab + n);
  for (int i = 0; i < n; i++) ans[tab[i].second] = a[i];
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
