#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long A[N];
pair<long long, int> B[N];
long long C[N];
int main() {
  ios_base::sync_with_stdio(false);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> A[i];
  }
  long long x;
  for (int i = 0; i < m; i++) {
    cin >> x;
    B[i] = {x, i};
  }
  sort(A, A + m, greater<long long>());
  sort(B, B + m);
  for (int i = 0; i < m; i++) {
    C[B[i].second] = A[i];
  }
  for (int i = 0; i < m; i++) {
    cout << C[i] << " ";
  }
  cout << endl;
  return 0;
}
