#include <bits/stdc++.h>
using namespace std;
using ii = pair<long long int, long long int>;
class prioritize {
 public:
  bool operator()(ii &p1, ii &p2) { return p1.first < p2.first; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int arr[n], brr[n], crr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long int i = 0; i < n; i++) {
    cin >> brr[i];
    crr[i] = brr[i];
  }
  vector<ii> b;
  for (long long int i = 0; i < n; i++) {
    b.push_back(make_pair(crr[i], i));
  }
  sort((b).begin(), (b).end());
  reverse((b).begin(), (b).end());
  long long int res[n];
  sort(arr, arr + n);
  for (long long int i = 0; i < n; i++) {
    res[b[i].second] = arr[i];
  }
  for (long long int i = 0; i < n; i++) {
    cout << res[i] << " ";
  }
}
