#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const double EPS = 1e-8;
const int N = 1e6 + 100;
const int M = 26;
const int MOD = 1e9 + 7;
int n;
int a[N], b[N];
int idb[N];
int ans[N];
bool cmp_b(int x, int y) { return b[x] < b[y]; }
int main() {
  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]), idb[i] = i;
  sort(a, a + n);
  sort(idb, idb + n, cmp_b);
  for (int i = 0; i < n; i++) ans[idb[i]] = a[n - i - 1];
  for (int i = 0; i < n; i++) printf("%d%c", ans[i], " \n"[i == n - 1]);
  return 0;
}
