#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> ara2[200005];
int ara[200005], i, n;
bool comp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {
  if (x.first.second < y.first.second) return true;
  return false;
}
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ara[i];
  }
  for (i = 0; i < n; i++) {
    cin >> ara2[i].first.first;
    ara2[i].first.second = i + 1;
  }
  sort(ara, ara + n);
  sort(ara2, ara2 + n);
  for (i = 0; i < n; i++) {
    ara2[i].second = ara[n - 1 - i];
  }
  sort(ara2, ara2 + n, comp);
  for (i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    cout << ara2[i].second;
  }
  cout << endl;
  return 0;
}
