#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-6;
const int INF = 0x3f3f3f3f;
inline int readint() {
  int sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
inline long long readLL() {
  long long sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
struct node {
  int x;
  int i;
} b[200005];
bool cmp(const node& a, const node& b) {
  return a.x == b.x ? a.i > b.i : a.x < b.x;
}
int a[200005], ans[200005];
int main() {
  int m = readint();
  for (int i = 0; i < m; i++) a[i] = readint();
  sort(a, a + m);
  for (int i = 0; i < m; i++) {
    b[i].x = readint();
    b[i].i = i;
  }
  sort(b, b + m, cmp);
  for (int i = 0; i < m; i++) {
    ans[b[i].i] = a[m - i - 1];
  }
  for (int i = 0; i < m; i++) {
    printf("%d", ans[i]);
    if (i < m - 1)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
