#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll OO = 1e18;
int di[8] = {0, 0, 1, -1, -1, 1, -1, 1};
int dj[8] = {1, -1, 0, 0, 1, 1, -1, -1};
string ys = "YES", no = "NO";
const long double dgr = acos(-1) / 180, dg = 180 / acos(-1);
const int mod = 1e9 + 7, N = 5e5 + 5, M = 5005;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> v(n), ans(n);
  for (auto& i : v) cin >> i;
  sort(v.rbegin(), v.rend());
  vector<pair<int, int> > v2(n);
  for (int i = 0; i < n; i++) {
    cin >> v2[i].first;
    v2[i].second = i;
  }
  sort(v2.begin(), v2.end());
  for (int i = 0; i < n; i++) ans[v2[i].second] = v[i];
  for (auto i : ans) cout << i << ' ';
}
