#include <bits/stdc++.h>
using namespace std;
int a[200004];
int b[200004];
vector<pair<int, int> > v;
int res[200004];
bool fc1(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
bool fc2(int a, int b) { return a > b; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
    v.push_back(make_pair(b[i], i));
  }
  sort(v.begin(), v.end(), fc1);
  sort(a, a + n, fc2);
  for (i = 0; i < n; i++) {
    res[v[i].second] = a[i];
  }
  for (i = 0; i < n; i++) cout << res[i] << " ";
  return 0;
}
