#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
const int INF = INT_MAX;
const int mod = 1e9 + 7;
const long long LINF = LLONG_MAX;
using namespace std;
int main() {
  int m;
  cin >> m;
  vector<pair<int, int>> a(m), b(m);
  for (int i = 0; i < (m); i++) scanf("%d", &a[i].first);
  for (int i = 0; i < (m); i++) scanf("%d", &b[i].first), b[i].second = i;
  sort(b.begin(), b.end());
  sort(a.rbegin(), a.rend());
  vector<int> answ(m);
  for (int i = 0; i < (m); i++) answ[b[i].second] = a[i].first;
  for (auto e : answ) cout << e << " ";
  cout << endl;
  return 0;
}
