#include <bits/stdc++.h>
using namespace std;
template <typename T>
void dprint(T begin, T end) {
  for (auto i = begin; i != end; i++) {
    cerr << (*i) << " ";
  }
  cerr << "\n";
}
int n;
long long a[220000];
long long b[220000];
long long ans[220000];
vector<pair<long long, int> > vv;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", a + i);
  for (int i = 0; i < n; ++i) scanf("%lld", b + i);
  for (int i = 0; i < n; ++i) vv.push_back(make_pair(b[i], i));
  sort(vv.begin(), vv.end());
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; ++i) {
    ans[vv[i].second] = a[i];
  }
  for (int i = 0; i < n; ++i) printf("%lld ", ans[i]);
  printf("\n");
  return 0;
}
