#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 100000 + 5;
int a[maxn];
int b[maxn];
int Pos[maxn];
struct node {
  int B;
  int pos;
  friend bool operator<(node x, node y) { return x.B < y.B; }
} F[maxn];
int cmp(int a, int b) { return a > b; }
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= N; i++) {
    scanf("%d", &b[i]);
    F[i].B = b[i];
    F[i].pos = i;
  }
  sort(a + 1, a + 1 + N, cmp);
  sort(F + 1, F + 1 + N);
  for (int i = 1; i <= N; i++) {
    Pos[F[i].pos] = i;
  }
  for (int i = 1; i <= N; i++) {
    cout << a[Pos[i]];
    if (i != N) cout << " ";
  }
  cout << endl;
  return 0;
}
