#include <bits/stdc++.h>
using namespace std;
const int maxm = 200000;
int m, a[maxm + 1], b[maxm + 1], res[maxm + 1], id[maxm + 1];
bool cmp(int x, int y) { return (b[x] < b[y]); }
int main() {
  ios_base::sync_with_stdio(0);
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  sort(a + 1, a + 1 + m);
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
    id[i] = i;
  }
  sort(id + 1, id + 1 + m, cmp);
  for (int i = 1; i <= m; i++) res[id[i]] = a[m - i + 1];
  for (int i = 1; i <= m; i++) cout << res[i] << ' ';
  return 0;
}
