#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6;
const int M = 4e3;
int a[N], b[N], k[N], r[N];
bool cmp(int x, int y) { return b[x] > b[y]; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    k[i] = i;
  }
  sort(a, a + n);
  sort(k, k + n, cmp);
  for (int i = 0; i < n; i++) r[k[i]] = a[i];
  for (int i = 0; i < n; i++) printf("%d ", r[i]);
  return 0;
}
