#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 10;
int n;
int a[N], b[N];
int res[N];
struct data {
  int a, b, idx;
  data(int a = 0, int b = 0, int idx = 0) : a(a), b(b), idx(idx) {}
  bool operator<(const data &o) const { return b < o.b; }
} t[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    t[i] = data(a[i], b[i], i);
  }
  sort(t + 1, t + 1 + n);
  sort(a + 1, a + 1 + n, greater<int>());
  for (int i = 1; i <= n; i++) {
    res[t[i].idx] = a[i];
  }
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
  return 0;
}
