#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
const int mxn = 2e5;
int m, a[mxn + 10];
void solve() {
  cin >> m;
  vi ans(m);
  vector<pi> v;
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    int b;
    cin >> b;
    v.push_back({b, i});
  }
  sort(a, a + m);
  sort(v.begin(), v.end());
  int k = 0;
  for (int i = m - 1; i >= 0; --i, ++k) ans[v[i].second] = a[k];
  for (const int &x : ans) cout << x << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
