#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
int ans[maxn];
struct node {
  int g, id;
} a[maxn], b[maxn];
bool cmp1(node x, node y) { return x.g > y.g; }
bool cmp2(node x, node y) { return x.g < y.g; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].g);
    a[i].id = i;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i].g);
    b[i].id = i;
  }
  sort(a, a + n, cmp1);
  sort(b, b + n, cmp2);
  for (int i = 0; i < n; ++i) {
    ans[b[i].id] = a[i].g;
  }
  for (int i = 0; i < n; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
