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