#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
pii b[200010];
int a[200010], x[200010];
int main() {
  int i, m;
  cin >> m;
  for (i = 1; i <= m; ++i) cin >> a[i];
  for (i = 1; i <= m; ++i) cin >> b[i].first, b[i].second = i;
  sort(a + 1, a + m + 1);
  sort(b + 1, b + m + 1);
  for (i = 1; i <= m; ++i) x[b[i].second] = a[m + 1 - i];
  for (i = 1; i <= m; ++i) cout << x[i] << ' ';
  cout << '\n';
  return 0;
}
