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