#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma + 1, args...);
}
long long n, x;
long long ans[200005];
vector<pair<long long, long long> > b, a;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    a.push_back({x, i});
  }
  for (int i = 0; i < n; ++i) {
    cin >> x;
    b.push_back({x, i});
  }
  sort((a).begin(), (a).end());
  sort((b).begin(), (b).end());
  reverse((b).begin(), (b).end());
  for (int i = 0; i < n; ++i) {
    ans[b[i].second] = a[i].first;
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
