#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
const double eps = 1e-6;
const double mod = 1e9 + 7;
struct num {
  int v, i;
} b[MAX];
bool cmp(const num &x, const num &y) { return x.v > y.v; }
bool cmp1(const num &x, const num &y) { return x.i < y.i; }
int main() {
  int m, a[MAX];
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i].v, b[i].i = i;
  sort(a + 1, a + m + 1);
  sort(b + 1, b + m + 1, cmp);
  for (int i = 1; i <= m; i++) b[i].v = a[i];
  sort(b + 1, b + m + 1, cmp1);
  for (int i = 1; i <= m; i++) cout << b[i].v << " ";
  putchar('\n');
}
