#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e6 + 100;
long long arr[maxN], brr[maxN], res[maxN];
int n, st;
vector<pair<long long, long long> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) cin >> brr[i];
  for (int i = 0; i < n; i++) v.push_back(make_pair(brr[i], i));
  sort(v.rbegin(), v.rend());
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    res[v[st].second] = arr[i];
    st++;
  }
  for (int i = 0; i < n; i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
