#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int brr[n];
  int c[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> brr[i];
  }
  pair<int, int> A[n];
  for (int i = 0; i < n; i++) {
    A[i] = make_pair(brr[i], i);
  }
  sort(A, A + n);
  sort(arr, arr + n, greater<int>());
  for (int i = 0; i < n; i++) {
    c[A[i].second] = arr[i];
  }
  for (int i = 0; i < n; i++) {
    cout << c[i] << " ";
  }
  return 0;
}
