#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e6 + 5;
int n;
int a[maxn];
int ans[maxn];
struct node {
  int x;
  int pos;
  bool operator<(const node& rhs) const { return x > rhs.x; }
} b[maxn];
int main() {
  while (~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].x);
      b[i].pos = i;
    }
    sort(a, a + n);
    sort(b, b + n);
    for (int i = 0; i < n; i++) {
      ans[b[i].pos] = a[i];
    }
    for (int i = 0; i < n; i++) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
