#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
pair<long long, long long> a[N], b[N];
map<int, int> m;
int c[N];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
    c[i] = a[i].first;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a, a + n);
  sort(b, b + n, greater<pair<long long, long long> >());
  for (int i = 0; i < n; i++) {
    m[b[i].second] = a[i].second;
  }
  for (int i = 0; i < n; i++) {
    cout << c[m[i]] << " ";
  }
  return 0;
}
