#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<pair<int, int>> a;
  vector<pair<int, int>> b;
  int sol[200000 + 5];
  int N;
  cin >> N;
  a.resize(N);
  b.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (int i = 0; i < N; ++i) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a.begin(), a.end(), greater<pair<int, int>>());
  sort(b.begin(), b.end());
  for (int i = 0; i < N; ++i) sol[b[i].second] = a[i].first;
  for (int i = 0; i < N; ++i) cout << sol[i] << " ";
  cout << "\n";
  return 0;
}
