#include <bits/stdc++.h>
using namespace std;
vector<long long> A, B, C, D;
int main() {
  long long m, i, j, a;
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> a;
    A.push_back(a);
  }
  for (i = 0; i < m; i++) {
    cin >> a;
    B.push_back(a);
  }
  C = A;
  D = B;
  sort(C.rbegin(), C.rend());
  sort(D.begin(), D.end());
  multimap<long long, long long> F;
  for (i = 0; i < m; i++) {
    F.insert({D[i], C[i]});
  }
  for (i = 0; i < m; i++) {
    A[i] = (*F.find(B[i])).second;
    F.erase(F.find(B[i]));
  }
  for (i = 0; i < m; i++) {
    cout << A[i] << ' ';
  }
}
