#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[200005], b[200005];
int ans[200005];
int B[200005], A[200005];
double nCr(int x, int y) {
  if (x < y) return 0;
  double a = 1;
  for (int w = 1; w <= x; w++) a *= w;
  for (int w = 1; w <= y; w++) a /= w;
  for (int w = 1; w <= x - y; w++) a /= w;
  return a;
}
double F(int n, int k) {
  double total = nCr(n, k);
  double w = 0;
  for (int x = 1; x <= n; x++) {
    w += x * nCr(n - x, k - 1);
  }
  return w / total;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first;
  for (int i = 0; i < n; i++) cin >> b[i].first;
  for (int i = 0; i < n; i++) {
    a[i].second = b[i].second = i;
    A[i] = a[i].first;
    B[i] = b[i].first;
    b[i].first *= -1;
  }
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < n; i++) ans[b[i].second] = a[i].first;
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
