#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int maxm = maxn * maxn;
const int inf = 0x3f3f3f3f;
int a[maxn], b[maxn];
pair<int, int> arr[maxn];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; i++) {
      scanf("%d", &arr[i].first);
      arr[i].second = i;
    }
    sort(a + 1, a + 1 + n);
    sort(arr + 1, arr + n + 1);
    for (int i = 1; i <= n; i++) {
      b[arr[i].second] = a[n - i + 1];
    }
    for (int i = 1; i <= n; i++) {
      if (i != 1) printf(" ");
      printf("%d", b[i]);
    }
    printf("\n");
  }
  return 0;
}
