#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const int inf = 1e9 + 10;
const long long INF = 1e18 + 10;
int n, newarr[N];
pair<int, int> a[N], b[N];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  for (int i = 0; i < n; i++) cin >> b[i].first, b[i].second = i;
  sort(a, a + n);
  reverse(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < n; i++) newarr[b[i].second] = a[i].first;
  for (int i = 0; i < n; i++) cout << newarr[i] << " ";
  return 0;
}
