#include <bits/stdc++.h>
using namespace std;
long long int C[300001];
vector<long long int> A;
vector<pair<long long int, long long int> > B;
int main() {
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    long long int x;
    cin >> x;
    A.push_back(x);
  }
  for (int i = 0; i < m; i++) {
    long long int x;
    cin >> x;
    B.push_back(make_pair(x, i));
  }
  sort(B.begin(), B.end());
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  for (int i = 0; i < m; i++) {
    C[B[i].second] = A[i];
  }
  for (int i = 0; i < m; i++) {
    cout << C[i] << " ";
  }
  return 0;
}
