#include <bits/stdc++.h>
using namespace std;
long long int inf = pow(10, 9) + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int m, x, y;
  scanf("%lld", &m);
  vector<long long int> a;
  map<long long int, long long int> ma;
  vector<pair<long long int, long long int> > b;
  for (long long int i = 0; i < m; ++i) scanf("%lld", &x), a.push_back(x);
  for (long long int i = 0; i < m; ++i) scanf("%lld", &x), b.push_back({x, i});
  sort(a.rbegin(), a.rend());
  sort(b.begin(), b.end());
  vector<pair<long long int, long long int> > ans;
  for (long long int i = 0; i < m; ++i)
    b[i].first = a[i], swap(b[i].first, b[i].second);
  sort(b.begin(), b.end());
  for (long long int i = 0; i < m; ++i)
    printf("%lld", b[i].second), printf(" ");
  return 0;
}
