#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
void func() {
  ll m;
  cin >> m;
  vll a(m), b(m);
  for (ll i = 0; i < m; i++) {
    cin >> a[i];
  }
  for (ll i = 0; i < m; i++) {
    cin >> b[i];
  }
  vll a_asc_idx(m), b_desc_idx(m);
  iota(a_asc_idx.begin(), a_asc_idx.end(), 0);
  iota(b_desc_idx.begin(), b_desc_idx.end(), 0);
  sort(a_asc_idx.begin(), a_asc_idx.end(),
       [&](ll &i, ll &j) -> bool { return a[i] < a[j]; });
  sort(b_desc_idx.begin(), b_desc_idx.end(),
       [&](ll &i, ll &j) -> bool { return b[i] > b[j]; });
  vll a_asc_idx_inv(m);
  for (ll i = 0; i < m; i++) {
    a_asc_idx_inv[a_asc_idx[i]] = i;
  }
  vll ans(m);
  for (ll i = 0; i < m; i++) {
    ans[b_desc_idx[i]] = a[a_asc_idx[i]];
  }
  for (ll i = 0; i < m; i++) {
    cout << ans[i] << ' ';
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  ll t = 1;
  for (ll i = 1; i <= t; i++) {
    func();
  }
}
