#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N], b[N], id[N], n, ans[N];
bool c1(int x, int y) { return b[x] > b[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), id[i] = i;
  sort(id + 1, id + 1 + n, c1);
  sort(a + 1, a + 1 + n);
  for (int i = n; i >= 1; i--) ans[id[i]] = a[i];
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
