#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
struct node {
  int x, y;
  friend bool operator<(const node &a, const node &b) { return a.x < b.x; }
} b[N];
int a[N], c[N], ans[N];
int n;
bool cmp(const int &a, const int &b) { return a > b; }
int main() {
  scanf("%d", &n);
  for (int i(1); i <= (n); ++i) scanf("%d", a + i);
  for (int i(1); i <= (n); ++i) {
    scanf("%d", &b[i].x);
    b[i].y = i;
  }
  sort(b + 1, b + n + 1);
  for (int i(1); i <= (n); ++i) c[b[i].y] = i;
  sort(a + 1, a + n + 1, cmp);
  for (int i(1); i <= (n); ++i) ans[b[i].y] = a[i];
  for (int i(1); i <= (n - 1); ++i) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
  return 0;
}
