#include <bits/stdc++.h>
using namespace std;
const int N = 200101, M = 102;
int n, k, m, A[N], B[N], C[N], mp[N];
string s;
vector<pair<int, int> > v;
int main() {
  cin >> m;
  for (int i = 0; i < m; i++) cin >> A[i];
  for (int i = 0; i < m; i++) {
    cin >> B[i];
    v.push_back({B[i], i});
  }
  sort(v.begin(), v.end());
  sort(A, A + m);
  reverse(A, A + m);
  int x = 0;
  for (int i = 0; i < v.size(); i++) {
    C[v[i].second] = A[x];
    x++;
  }
  for (int i = 0; i < m; i++) cout << C[i] << " ";
}
