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