#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 2e5 + 10;
const int N = 2e3 + 10;
const int M = 1e3 + 10;
int ans[MAXN];
vector<int> a;
vector<pair<int, int> > b;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  for (int j = 1; j <= n; j++) {
    int x;
    cin >> x;
    b.push_back({x, j});
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    int idx = b[i].second;
    ans[idx] = a[i];
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
