#include <bits/stdc++.h>
using namespace std;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> a, b;
  vector<pair<long long, long long>> c;
  for (long long i = 0; i < n; i++) {
    long long f;
    cin >> f;
    a.push_back(f);
  }
  for (long long i = 0; i < n; i++) {
    long long f;
    cin >> f;
    b.push_back(f);
    c.push_back({f, i});
  }
  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  vector<long long> ans;
  ans.resize(a.size());
  sort(a.begin(), a.end());
  while (a.size()) {
    ans[c.back().second] = a.back();
    c.pop_back();
    a.pop_back();
  }
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
