#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5);
int n;
struct arr {
  int val, idx;
} a[N], b[N];
bool cmp_inc(arr a, arr b) { return a.val < b.val; }
bool cmp_dec(arr a, arr b) { return a.val > b.val; }
bool cmp_idx(arr a, arr b) { return a.idx < b.idx; }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].val;
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i].val;
    b[i].idx = i;
  }
  sort(a, a + n, cmp_dec);
  sort(b, b + n, cmp_inc);
  for (int i = 0; i < n; ++i) {
    a[i].idx = b[i].idx;
  }
  sort(a, a + n, cmp_idx);
  for (int i = 0; i < n; ++i) cout << a[i].val << " ";
  return 0;
}
