#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int pow1(long long int x, unsigned long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = pow1(x, y / 2);
  if (y % 2 == 0)
    return (temp * temp) % (long long int)(1e9 + 7);
  else
    return ((x * temp) % (long long int)(1e9 + 7) * (temp) %
            (long long int)(1e9 + 7)) %
           (long long int)(1e9 + 7);
}
long long int inv_mod(long long int a) {
  long long int res = 1;
  long long int mod_temp = (long long int)(1e9 + 7) - 2;
  while (mod_temp) {
    if (mod_temp & 1) {
      res =
          ((res % (long long int)(1e9 + 7)) * (a % (long long int)(1e9 + 7))) %
          (long long int)(1e9 + 7);
    }
    a = ((a % (long long int)(1e9 + 7)) * (a % (long long int)(1e9 + 7))) %
        (long long int)(1e9 + 7);
    mod_temp >>= 1;
  }
  return res % (long long int)(1e9 + 7);
}
long long int ncr(long long int n, long long int k) {
  long long int res = 1;
  if (k > n - k) k = n - k;
  for (long long int i = 0; i < k; ++i) {
    res = ((res % (long long int)(1e9 + 7)) *
           ((n - i) % (long long int)(1e9 + 7))) %
          (long long int)(1e9 + 7);
    res = ((res % (long long int)(1e9 + 7)) *
           (inv_mod(i + 1) % (long long int)(1e9 + 7))) %
          (long long int)(1e9 + 7);
  }
  return res % (long long int)(1e9 + 7);
}
long long int fibonacci(long long int n) {
  double phi = (1LL + sqrt(5)) / (double)2;
  long long int nth_fib = round(pow(phi, n) / sqrt(5));
  return nth_fib;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int arr[n], brr[n], crr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  map<pair<long long int, long long int>, long long int> mp1;
  for (long long int i = 0; i < n; i++) {
    cin >> brr[i];
    mp1[{brr[i], i}] = 1;
    crr[i] = brr[i];
  }
  sort(crr, crr + n);
  sort(arr, arr + n, greater<long long int>());
  auto it = mp1.begin();
  long long int i = 0;
  while (it != mp1.end()) {
    auto f = it->first;
    long long int s = it->second;
    mp1[f] = arr[i];
    i++;
    it++;
  }
  for (long long int i = 0; i < n; i++) {
    cout << mp1[{brr[i], i}] << " ";
  }
  cout << '\n';
  return 0;
}
