#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[200005], b[200005];
  vector<pair<int, int>> bb;
  int ans[200005];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", b + i);
    bb.push_back(make_pair(b[i], i));
  }
  sort(a, a + n);
  sort(bb.begin(), bb.end());
  for (int i = 0; i < n; i++) {
    ans[bb[i].second] = a[n - 1 - i];
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
