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