#include <bits/stdc++.h>
using namespace std;
long long mod = pow(10, 9) + 7;
int main() {
  long long m, i, j, k;
  cin >> m;
  long long a[m], b[m];
  for (i = 0; i < m; i++) cin >> a[i];
  for (i = 0; i < m; i++) cin >> b[i];
  multimap<long long, long long> map1, map2;
  for (i = 0; i < m; i++) {
    map1.insert(make_pair(b[i], i));
  }
  sort(a, a + m, greater<long long>());
  i = 0;
  for (auto x : map1) {
    map2.insert(make_pair(x.second, a[i]));
    i++;
  }
  for (auto x : map2) {
    cout << x.second << " ";
  }
  return 0;
}
