#include <bits/stdc++.h>
const long long INF = 4e18L + 1;
const int IINF = 1e9 + 1;
const int N = 1048576;
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> b(n);
  vector<int> a(n);
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a[i];
  }
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort((b).begin(), (b).end());
  sort((a).begin(), (a).end());
  vector<int> wyn(n);
  for (long long i = (long long)0; i < (long long)n; i++) {
    wyn[b[i].second] = a[n - i - 1];
  }
  for (long long i = (long long)0; i < (long long)n; i++) {
    cout << wyn[i] << " ";
  }
}
