#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 1e18 + 1;
const int MAX = 200001;
const long long MOD = 1000000007;
const double PI = 3.14159265358979323846264338327;
long long inq(long long k, long long q, long long mod) {
  if (q == 0) return 1;
  long long l = inq(k, q / 2, mod);
  if (q % 2 == 0)
    return l * l % mod;
  else
    return l * l % mod * k % mod;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long cubr(long long a) {
  long long l = -1, r = 1e6 + 2;
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (mid * mid * mid > a)
      r = mid;
    else
      l = mid;
  }
  return l;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) { return -1 * max(-a, -b); }
long long possible(long long q) {
  if (q == INF) return -1;
  return q;
}
bool correct(int x, int xx) {
  if (x < 0) return 0;
  if (x >= xx) return 0;
  return 1;
}
long long dsumm(long long x, long long k) {
  long long y = 1;
  long long z = 0;
  for (int i = 0; y < 1e18; i++) {
    z += x / y % k;
    y *= k;
  }
  return z;
}
long long dcount(long long x) {
  long long y = 1;
  long long z = 0;
  int c[100];
  for (int i = 0; i < 10; i++) c[i] = 0;
  for (int i = 0; x > 0; i++) {
    if (c[x / y % 10] == 0) z++;
    c[x / y % 10] = 1;
    x /= 10;
  }
  return z;
}
long long lg10(long long x) {
  if (10000 <= x && x < 100000) return 5;
  if (x == 0) return 0;
  return lg10(x / 10) + 1;
}
int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long g(long long x, long long mod) {
  if (x == 0) return 0;
  return x / mod + g(x / mod, mod);
}
long long fact(int x) {
  if (x == 0) return 1;
  return x * fact(x - 1);
}
long long a[500000], n;
pair<long long, long long> b[500000];
long long ans[500000];
signed main() {
  cin >> n;
  for (int(i) = 0; (i) != (n); i++) {
    cin >> a[i];
  }
  for (int(i) = 0; (i) != (n); i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(a, a + n);
  sort(b, b + n);
  reverse(a, a + n);
  for (int(i) = 0; (i) != (n); i++) {
    ans[b[i].second] = a[i];
  }
  for (int(i) = 0; (i) != (n); i++) {
    cout << ans[i] << " ";
  }
}
