#include <bits/stdc++.h>
using namespace std;
long long sum(long long n) { return (n * (n - 1)) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int arr[n + 1];
  for (int i = 0; i < n; i++) cin >> arr[i];
  pair<int, int> b[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b, b + n);
  sort(arr, arr + n, greater<int>());
  long long a[n + 1];
  for (int i = 0; i < n; i++) {
    a[b[i].second] = arr[i];
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
