#include <bits/stdc++.h>
using namespace std;
struct my {
  int a;
  int b;
  int c;
};
int main() {
  int n, x;
  cin >> n;
  vector<int> A;
  vector<int> B;
  vector<int> C;
  for (int i = 0; i < n; i++) {
    cin >> x;
    A.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    B.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    C.push_back(B[i]);
  }
  sort(A.begin(), A.end(), greater<int>());
  sort(B.begin(), B.end());
  vector<my> ans;
  for (int i = 0; i < n; i++) {
    my temp;
    temp.a = A[i];
    temp.b = B[i];
    temp.c = 0;
    ans.push_back(temp);
  }
  map<int, stack<int> > hash;
  for (int i = 0; i < ans.size(); i++) {
    hash[ans[i].b].push(ans[i].a);
  }
  for (int i = 0; i < C.size(); i++) {
    cout << hash[C[i]].top() << " ";
    hash[C[i]].pop();
  }
  return 0;
}
