#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5, N2 = 2e5, N1 = 1e6, M = 1e2;
long long binpow(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans *= a;
    a *= a;
    n >>= 1;
  }
  return ans;
}
string s, s1, s2;
long long n, m, t, x, y, z;
long long a[200000];
pair<long long, long long> b[200000];
long long k, k1, k2, g, g1, g2, ans, kol, kol1;
int main() {
  long long t1;
  k = 0;
  k1 = 0;
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) cin >> b[i].first, b[i].second = i;
  sort(a, a + n);
  reverse(a, a + n);
  sort(b, b + n);
  for (long long i = 0; i < n; ++i) {
    b[i].first = a[i];
    swap(b[i].first, b[i].second);
  }
  sort(b, b + n);
  for (long long i = 0; i < n; ++i) cout << b[i].second << " ";
  return 0;
}
