#include <bits/stdc++.h>
using namespace std;
const int64_t mod = 1000000007;
int64_t maxm(int64_t a, int64_t b) { return a > b ? a : b; }
int64_t minm(int64_t a, int64_t b) { return a > b ? b : a; }
int64_t powr(int64_t x, int64_t n) {
  int64_t result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = result * x;
    x = x * x;
    n = n / 2;
  }
  return result;
}
const int64_t inf = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  int64_t n, i;
  cin >> n;
  vector<int64_t> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a.rbegin(), a.rend());
  vector<pair<int64_t, int64_t> > v;
  for (i = 0; i < n; i++) {
    int64_t x;
    cin >> x;
    v.push_back({x, i});
  }
  sort(v.begin(), v.end());
  int64_t c[n];
  for (i = 0; i < n; i++) {
    c[v[i].second] = a[i];
  }
  for (i = 0; i < n; i++) cout << c[i] << " ";
}
