#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  vector<pair<long long, long long> > d;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    d.push_back(pair<long long, long long>(b[i], i));
  }
  sort(d.begin(), d.end());
  vector<long long> ans(n);
  for (long long i = 0; i < n; i++) {
    ans[d[i].second] = a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
}
