#include <bits/stdc++.h>
using namespace std;
int a[200004];
vector<pair<int, int> > b, c;
int main() {
  int n, x;
  while (scanf(" %d", &n) == 1) {
    for (int i = 0; i < n; i++) {
      scanf(" %d", &a[i]);
    }
    for (int i = 0; i < n; i++) {
      scanf(" %d", &x);
      b.push_back(make_pair(x, i));
    }
    sort(b.rbegin(), b.rend());
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      c.push_back(make_pair(b[i].second, a[i]));
    }
    sort(c.begin(), c.end());
    for (int i = 0; i < n; i++) {
      printf("%d ", c[i].second);
    }
    printf("\n");
    b.clear();
    c.clear();
  }
}
