#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N], c[N];
pair<int, int> b[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a, a + n, greater<int>());
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    c[b[i].second] = a[i];
  }
  for (int i = 0; i < n; i++) {
    cout << c[i] << ' ';
  }
}
