#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1000 * 100 + 1000;
int n;
pair<int, int> a[MAXN], b[MAXN];
int ans[MAXN];
int p[MAXN];
bool comp(const pair<int, int>& x, const pair<int, int>& y) {
  return (x.first >= y.first);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    p[i] = x;
    a[i] = make_pair(x, i);
  }
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    b[i] = make_pair(x, i);
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) {
    ans[b[i].second] = a[n - i + 1].second;
  }
  for (int i = 1; i <= n; i++) cout << p[ans[i]] << " ";
  return 0;
}
