#include <bits/stdc++.h>
using namespace std;
int main() {
  fflush(stdin);
  cout << fixed, cout.precision(18);
  ios_base::sync_with_stdio(false);
  int n, i, j, k;
  string second;
  cin >> n;
  pair<int, int> a[n], b[n];
  int c[n];
  for (i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (i = 0; i < n; ++i) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a, a + n);
  sort(b, b + n, greater<pair<int, int> >());
  for (i = 0; i < n; ++i) c[b[i].second] = a[i].first;
  for (i = 0; i < n; ++i) cout << c[i] << " ";
}
