#include <bits/stdc++.h>
using namespace std;
struct nodes {
  int id, val;
};
int a[200010];
int ans[200010];
nodes b[200010];
bool compare(nodes s, nodes c) { return s.val < c.val; }
int main() {
  int n;
  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].val);
    b[i].id = i;
  }
  sort(a, a + n);
  reverse(a, a + n);
  sort(b, b + n, compare);
  for (int i = 0; i < n; i++) {
    ans[b[i].id] = a[i];
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
