#include <bits/stdc++.h>
using namespace std;
const int SS = 5e2 + 123;
const int N = 1e5 + 123;
const int NN = 1e6 + 123;
const int M = 1e7 + 123;
const int MM = 1e8 + 123;
const int inf = 1e9 + 123;
const long long INF = 1e18 + 123;
const long long MAXN = 1e10 + 123;
int n, a[3 * N], b, c[3 * N];
pair<int, int> b1[3 * N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    cin >> b;
    b1[i].first = b;
    b1[i].second = i;
  }
  sort(b1 + 1, b1 + 1 + n);
  sort(a + 1, a + 1 + n);
  reverse(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) c[b1[i].second] = a[i];
  for (int i = 1; i <= n; i++) cout << c[i] << " ";
}
