#include <bits/stdc++.h>
using namespace std;
int n, a[200010], out[200010];
pair<int, int> b[200010];
int comp(int x, int y) { return x > y; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i].first);
    b[i].second = i;
  }
  sort(b + 1, b + n + 1);
  sort(a + 1, a + n + 1, comp);
  for (int i = 1; i <= n; i++) out[b[i].second] = a[i];
  for (int i = 1; i <= n; i++) printf("%d ", out[i]);
}
