#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
template <class Os, class It>
Os&& _out(Os&& os, It f, It l, string d = ", ") {
  if (f == l) return os << "{}";
  os << "{ " << *f++;
  for (; f != l; os << d << *f++)
    ;
  return os << " }";
}
template <class Os, class T>
auto operator<<(Os&& os, const T& v) -> decltype(v.begin(), v.end(), os) {
  return _out(os, v.begin(), v.end());
}
template <class Os, class F, class S>
Os&& operator<<(Os&& os, const pair<F, S>& p) {
  return os << "[" << p.first << ", " << p.second << "]";
}
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
const long double PI = acos(-1);
complex<double> IM{0, 1};
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<pii> b(n);
  for (auto& x : a) cin >> x;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b[i] = {x, i};
  }
  sort(a.begin(), a.end(), greater<int>{});
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    b[i].first = a[i];
  }
  sort(b.begin(), b.end(), [](pii x, pii y) { return x.second < y.second; });
  for (auto x : b) cout << x.first << ' ';
  return 0;
}
