#include <bits/stdc++.h>
using namespace std;
int m;
int a[200005], save[200005];
pair<int, int> b[200005];
void nhap() {
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  nhap();
  sort(a + 1, a + m + 1);
  sort(b + 1, b + m + 1);
  for (int i = 1; i <= m; i++) save[b[i].second] = a[m - i + 1];
  for (int i = 1; i <= m; i++) cout << save[i] << " ";
}
