#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int, int>;
using ll = long long int;
template <typename T1, typename T2, typename T3>
T1 modpow(T1 _a, T2 p, T3 mod) {
  assert(p >= 0);
  ll ret = 1, a = _a;
  if (a < 0) {
    a %= mod;
    a += mod;
  }
  if (a >= mod) {
    a %= mod;
  }
  for (; p > 0; p /= 2) {
    if (p & 1) ret = ret * a % mod;
    a = a * a % mod;
  }
  return ret;
}
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr int mx_n = 200005;
int a[mx_n], b[mx_n], ans[mx_n], n;
int main() {
  cin >> n;
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) cin >> a[i];
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) cin >> b[i];
  vector<pi> v;
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) v.emplace_back(b[i], -i);
  sort((v).begin(), (v).end());
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) ans[-v[i].second] = a[i];
  for (int i = ((0)), _i = ((n)-1); i <= _i; ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
