#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q, k, m;
  long long ini, j, count = 0;
  cin >> m;
  vector<pair<long long, long long> > a(m);
  vector<pair<long long, long long> > b(m);
  for (long long i = 0; i < m; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (long long i = 0; i < m; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  vector<long long> c(m);
  for (long long i = m - 1; i >= 0; i--) {
    c[b[i].second] = a[m - i - 1].first;
  }
  for (long long i = 0; i < m; i++) cout << c[i] << " ";
  return 0;
}
