#include <bits/stdc++.h>
using namespace std;
struct MyStruct {
  int num, flag;
} b[200007];
bool cmp1(MyStruct a, MyStruct b) {
  if (a.num == b.num) return a.flag > b.flag;
  return a.num < b.num;
}
bool cmp2(MyStruct a, MyStruct b) { return a.flag < b.flag; }
int main() {
  int a[200007], n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i].num;
    b[i].flag = i;
  }
  sort(a, a + n);
  sort(b, b + n, cmp1);
  for (int i = 0; i < n; i++) b[i].num = a[n - i - 1];
  sort(b, b + n, cmp2);
  for (int i = 0; i < n - 1; i++) cout << b[i].num << " ";
  cout << b[n - 1].num << endl;
  return 0;
}
