#include <bits/stdc++.h>
using namespace std;
long long arr[1000009];
long long brr[1000009];
vector<pair<long long, long long> > v;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &brr[i]);
    v.push_back({brr[i], i});
  }
  sort(arr, arr + n);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    brr[v[i].second] = arr[i];
  }
  for (int i = 0; i < n; i++) cout << brr[i] << " ";
}
