#include <bits/stdc++.h>
using namespace std;
const int MAXM = int(2e5);
int M;
int A[MAXM];
int B[MAXM];
int aord[MAXM];
int bord[MAXM];
int ans[MAXM];
signed main() {
  ios::sync_with_stdio(false);
  cin >> M;
  for (int i = 0; i < M; ++i) {
    cin >> A[i];
    aord[i] = i;
  }
  for (int i = 0; i < M; ++i) {
    cin >> B[i];
    bord[i] = i;
  }
  sort(aord, aord + M, [&](int i, int j) { return A[i] > A[j]; });
  sort(bord, bord + M, [&](int i, int j) { return B[i] < B[j]; });
  for (int i = 0; i < M; ++i) {
    ans[bord[i]] = aord[i];
  }
  for (int i = 0; i < M; ++i) {
    cout << A[ans[i]] << " \n"[i + 1 == M];
  }
  return 0;
}
