#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long n;
int t[200002], ans[200002];
struct punct {
  int pi;
  int val;
} v[200002];
bool cmp(punct a, punct b) {
  if (a.val == b.val) return a.pi < b.pi;
  return a.val < b.val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++) cin >> v[i].val, v[i].pi = i;
  sort(v + 1, v + n + 1, cmp);
  sort(t + 1, t + n + 1);
  for (int i = 1; i <= n; i++) ans[v[i].pi] = t[n - i + 1];
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
