#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N], b[N], ans[N];
struct tyc {
  int v, id;
} px[N];
int m;
bool cmp(tyc a, tyc b) { return a.v < b.v; }
bool cmpp(int a, int b) { return a > b; }
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]), px[i].v = b[i], px[i].id = i;
  sort(a + 1, a + 1 + m, cmpp);
  sort(px + 1, px + 1 + m, cmp);
  for (int i = 1; i <= m; i++) ans[px[i].id] = a[i];
  for (int i = 1; i <= m; i++) cout << ans[i] << " ";
}
