#include <bits/stdc++.h>
using namespace std;
string alph = "abcdefghijklmnopqrstuvwxyz";
string ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
double pi = 3.1415926535;
double e = 2.7182818284;
vector<int> a;
vector<pair<int, int>> b;
int c[200005];
int main() {
  ios::sync_with_stdio(false);
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    b.push_back(make_pair(x, i));
  }
  sort(b.begin(), b.end());
  sort(a.begin(), a.end());
  for (int i = 0; i < m; ++i) {
    c[b[m - 1 - i].second] = a[i];
  }
  for (int i = 0; i < m; ++i) cout << c[i] << " ";
  return 0;
}
