#include <bits/stdc++.h>
using namespace std;
const int MaxN = 250000;
int a[MaxN], b[MaxN];
int output[MaxN];
vector<pair<int, int>> a_pair, b_pair;
vector<int> b_inv, b_perm;
int M;
int main() {
  cin >> M;
  for (int i = 0; i < M; i++) {
    scanf("%d", a + i);
    a_pair.push_back({a[i], i});
  }
  for (int i = 0; i < M; i++) {
    scanf("%d", b + i);
    b_pair.push_back({b[i], i});
  }
  sort(a_pair.begin(), a_pair.end());
  sort(b_pair.begin(), b_pair.end());
  for (auto x : b_pair) b_inv.push_back(x.second);
  for (auto x : b_pair) {
    b_perm.push_back(x.second);
  }
  for (int i = 0; i < M; i++) {
    int ind = b_perm[i];
    output[ind] = a_pair[M - 1 - i].first;
  }
  for (int i = 0; i < M; i++) printf("%d ", output[i]);
  return 0;
}
