#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535897;
int n;
vector<pair<int, int> > va, vb;
int a[500100], b[500100];
int ans[500100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    va.push_back(make_pair(x, i));
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    vb.push_back(make_pair(x, i));
  }
  sort(va.begin(), va.end());
  reverse(va.begin(), va.end());
  sort(vb.begin(), vb.end());
  for (int i = 0; i < va.size(); i++) {
    int t = va[i].first;
    int pos = vb[i].second;
    ans[pos] = t;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
