#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return (b == 0) ? a : gcd(b, a % b);
}
const unsigned int MOD = 1000000007;
template <class T>
T power(T a, long long int n) {
  T res = 1;
  while (n > 0) {
    if (n % 2) res = (res * a);
    a = (a * a), n = n / 2;
  }
  return res;
}
unsigned int factorial(unsigned int n) {
  if (n == 0) return 1;
  return n * factorial(n - 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, temp, a;
  cin >> n;
  temp = n;
  vector<long long int> arr;
  ;
  vector<pair<long long int, long long int> > brr;
  vector<long long int> ans(n, 0);
  ;
  while (temp--) cin >> a, arr.push_back(a);
  temp = n;
  ;
  sort(arr.begin(), arr.end(), greater<int>());
  ;
  for (int i = 0; i < n; i++) {
    cin >> a;
    brr.push_back(make_pair(a, i));
  };
  sort(brr.begin(), brr.end());
  ;
  for (int i = 0; i < n; i++) {
    ans[brr[i].second] = arr[i];
  };
  for (int i = 0; i < ans.size(); i++) cout << ans.at(i) << " ";
  ;
}
