#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long long MAXN = 1000001;
const long long MAXVAL = 5000000;
const long long INF = (long long)1e17 + 100;
const long long MOD = (long long)1e9 + 7;
string failMessage;
void fail() {
  cout << failMessage;
  exit(0);
}
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (int j = 0; j < n; j++) {
    cin >> b[j].first;
    b[j].second = j;
  }
  sort(a.rbegin(), a.rend());
  sort(b.begin(), b.end());
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[b[i].second] = a[i].first;
  }
  for (int i = 0; i < n; i++) {
    if (i) {
      cout << " ";
    }
    cout << ans[i];
  }
}
int main() {
  const string FILENAME = "input";
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  solve();
}
