#include <bits/stdc++.h>
using namespace std;
const int maxn = (100000 + 5) * 2;
struct nood {
  long long x;
  int p;
} s[maxn], st[maxn];
bool cmp(nood a, nood b) { return a.x > b.x; }
bool cmp1(nood a, nood b) { return a.x < b.x; }
bool cmp2(nood a, nood b) { return a.p < b.p; }
int main() {
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> s[i].x;
    s[i].p = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> st[i].x;
    st[i].p = i;
  }
  sort(s, s + m, cmp);
  sort(st, st + m, cmp1);
  for (int i = 0; i < m; i++) s[i].p = st[i].p;
  sort(s, s + m, cmp2);
  for (int i = 0; i < m; i++) {
    cout << s[i].x;
    if (i != m - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
