#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n;
  cin >> n;
  vector<long long> A(n);
  vector<pair<long long, long long> > B(n);
  for (auto& s : A) cin >> s;
  for (int i = 0; i < n; i++) {
    cin >> B[i].first;
    B[i].second = i;
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  sort(B.begin(), B.end());
  vector<long long> Anew(n, 0);
  for (int i = 0; i < n; i++) {
    Anew[B[i].second] = A[i];
  }
  for (int i = 0; i < n; i++) {
    cout << Anew[i] << " \n"[i == n - 1];
  }
}
