#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, m;
  cin >> m;
  long long a[m];
  vector<pair<long long, long long> > b(m);
  for (i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m, greater<long long>());
  for (i = 0; i < m; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b.begin(), b.end());
  int out[m];
  int t = 0;
  for (i = 0; i < m; i++) out[b[i].second] = a[t++];
  for (i = 0; i < m; i++) cout << out[i] << " ";
}
