#include <bits/stdc++.h>
using namespace std;
const pair<int, int> queen[8] = {pair<int, int>(-1, 0), pair<int, int>(-1, 1),
                                 pair<int, int>(0, 1),  pair<int, int>(1, 1),
                                 pair<int, int>(1, 0),  pair<int, int>(1, -1),
                                 pair<int, int>(0, -1), pair<int, int>(-1, -1)};
const int maxN = 2e5 + 11;
typedef int i_N[maxN];
int N;
i_N A, B, id, ans;
pair<int, int> operator+(const pair<int, int> &a, const pair<int, int> &b) {
  return pair<int, int>(a.first + b.first, a.second + b.second);
}
int cmp(int i, int j) { return B[i] > B[j]; }
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int i = 1; i <= N; i++) cin >> B[i], id[i] = i;
  sort(id + 1, id + N + 1, cmp);
  sort(A + 1, A + N + 1);
  for (int i = 1; i <= N; i++) ans[id[i]] = A[i];
  for (int i = 1; i <= N; i++) cout << ans[i] << ' ';
}
