#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
pair<int, int> arr[N];
int a[N], b[N], bb[N], r[N];
int finall[N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i].second;
  for (int i = 0; i < n; i++) a[i] = arr[i].second;
  for (int i = 0; i < n; i++) cin >> arr[i].first;
  for (int i = 0; i < n; i++) arr[i].second = i;
  sort(arr, arr + n,
       [](pair<int, int> i, pair<int, int> j) { return i.first > j.first; });
  sort(a, a + n);
  for (int i = 0; i < n; i++) finall[arr[i].second] = a[i];
  for (int i = 0; i < n; i++) cout << finall[i] << " ";
}
