#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
void fillString(string &s, char x) {
  for (int i = 0; i < s.size(); i++) s[i] = x;
}
long long int max(long long int a, long long int b) { return a >= b ? a : b; }
long long int min(long long int a, long long int b) { return a >= b ? b : a; }
long long int power(long long int base, long long int exponent,
                    long long int modulus) {
  long long int result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long int i, j, t, test, x, y, k, n, m, a, b, c, d;
long long int testArray[10] = {5, 2, 3, 1, 8, 4, 9, 7, 6, 0};
long long int A[1010101] = {0};
vector<long long int> adj[1001100], children[1001000];
void solve() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  sort(A + 1, A + 1 + n);
  reverse(A + 1, A + 1 + n);
  vector<pair<long long int, long long int>> store;
  for (i = 1; i <= n; i++) {
    cin >> x;
    store.push_back({x, i});
  }
  sort(store.begin(), store.end());
  vector<long long int> ans(n + 1);
  for (i = 0; i < n; i++) {
    ans[store[i].second] = A[i + 1];
  }
  for (i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
}
int main() {
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
