#include <bits/stdc++.h>
using namespace std;
bool inc(vector<int> a, vector<int> b) { return (a[0] < b[0]); }
int main() {
  int m;
  scanf("%d", &m);
  int a[m], ans[m];
  vector<vector<int>> b(m, vector<int>(2));
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    cin >> b[i][0];
    b[i][1] = i;
  }
  sort(b.begin(), b.end(), inc);
  sort(a, a + m);
  for (int i = m - 1; i >= 0; --i) ans[b[m - i - 1][1]] = a[i];
  for (int i = 0; i < m; ++i) printf("%d ", ans[i]);
  return 0;
}
