#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int mod = 1000000007;
const double pi = acos(-1.0);
struct node {
  int ind;
  int num;
} ns[200022];
int a[200022];
bool cmp(node a, node b) { return a.num < b.num; }
bool cmp2(node a, node b) { return a.ind < b.ind; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> ns[i].num;
    ns[i].ind = i;
  }
  sort(ns, ns + n, cmp);
  sort(a, a + n);
  for (int i = 0; i < n; i++) ns[i].num = a[n - i - 1];
  sort(ns, ns + n, cmp2);
  for (int i = 0; i < n; i++) cout << ns[i].num << " ";
  cout << " ";
  cout << endl;
}
