#include <bits/stdc++.h>
using namespace std;
void qsortA(vector<int> &a, int first, int last) {
  int i = first, j = last, x = a[(first + last) / 2];
  do {
    while (a[i] > x) {
      i++;
    }
    while (a[j] < x) {
      j--;
    }
    if (i <= j) {
      if (i < j) swap(a[i], a[j]);
      i++;
      j--;
    }
  } while (i <= j);
  if (i < last) qsortA(a, i, last);
  if (first < j) qsortA(a, first, j);
}
void qsortB(vector<int> &a, vector<int> &b, int first, int last) {
  int i = first, j = last, x = a[(first + last) / 2];
  do {
    while (a[i] < x) {
      i++;
    }
    while (a[j] > x) {
      j--;
    }
    if (i <= j) {
      if (i < j) {
        swap(a[i], a[j]);
        swap(b[i], b[j]);
      }
      i++;
      j--;
    }
  } while (i <= j);
  if (i < last) qsortB(a, b, i, last);
  if (first < j) qsortB(a, b, first, j);
}
int main() {
  int m;
  cin >> m;
  vector<int> A(m), Asort(m), Bsort(m), Bkey(m);
  for (int i = 0; i < m; i++) cin >> Asort[i];
  for (int i = 0; i < m; i++) {
    cin >> Bsort[i];
    Bkey[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int tmp = rand() % m;
    swap(Bsort[i], Bsort[tmp]);
    swap(Bkey[i], Bkey[tmp]);
  }
  qsortA(Asort, 0, m - 1);
  qsortB(Bsort, Bkey, 0, m - 1);
  for (int i = 0; i < m; i++) {
    A[Bkey[i]] = Asort[i];
  }
  for (int i = 0; i < m; i++) cout << A[i] << " ";
  return 0;
}
