#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int m;
int a[N];
pair<int, int> b[N], ans[N];
bool cmp(pair<int, int> u, pair<int, int> v) { return u.second < v.second; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> m;
  for (int i = (int)0; i < (int)m; ++i) cin >> a[i];
  int x;
  for (int i = (int)0; i < (int)m; ++i) {
    cin >> x;
    b[i] = {x, i};
  }
  sort(b, b + m);
  sort(a, a + m);
  reverse(a, a + m);
  for (int i = (int)0; i < (int)m; ++i) {
    ans[i] = {a[i], b[i].second};
  }
  sort(ans, ans + m, cmp);
  for (int i = (int)0; i < (int)m; ++i) cout << ans[i].first << " ";
  return 0;
}
