#include <bits/stdc++.h>
using namespace std;
void cass() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 2e5 + 4;
int n, a[N], b[N], ans[N];
pair<int, int> c[N];
bool cmp(int a, int b) { return a > b; }
void read() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) cerr << a[i];
  for (int i = 1; i <= n; ++i) c[i] = pair<int, int>(b[i], i);
  sort(c + 1, c + n + 1);
  for (int i = 1; i <= n; ++i) ans[c[i].second] = a[i];
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
int main() {
  cass();
  read();
  return 0;
}
