#include <bits/stdc++.h>
using namespace std;
struct node {
  int num;
  int pos;
  const bool operator<(const node &a) const { return num < a.num; }
};
int o[200010];
int ans[200010];
node u[200010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &o[i]);
  sort(o, o + n, greater<int>());
  for (int i = 0; i < n; i++) {
    scanf("%d", &u[i].num);
    u[i].pos = i;
  }
  sort(u, u + n);
  for (int i = 0; i < n; i++) ans[u[i].pos] = o[i];
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
