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