#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N], ans[N];
pair<int, int> b[N];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i]);
  for (int i = 0; i < int(n); i++) scanf("%d", &b[i].first), b[i].second = i;
  sort(a, a + n);
  reverse(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < int(n); i++) ans[b[i].second] = a[i];
  for (int i = 0; i < int(n); i++) printf("%d ", ans[i]);
  return 0;
}
