#include <bits/stdc++.h>
using namespace std;
long long m;
vector<pair<long long, long long> > ans(1);
struct Data {
  long long x, ind;
} a[200001], b[200001];
bool comp(Data A, Data B) { return (A.x > B.x); }
bool comp1(Data A, Data B) { return (A.x < B.x); }
int main() {
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> b[i].x;
    b[i].ind = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a[i].x;
    a[i].ind = i;
  }
  sort(a + 1, a + 1 + m, comp1);
  sort(b + 1, b + 1 + m, comp);
  for (int i = 1; i <= m; i++) {
    if (b[i].x >= a[i].x)
      ans.push_back(make_pair(a[i].ind, b[i].x));
    else {
      for (int j = i; j >= 1; j--) {
        if (ans[j].second >= a[i].x) {
          swap(b[i].x, ans[j].second);
          ans.push_back(make_pair(a[i].ind, b[i].x));
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  for (int k = 1; k <= m; k++) cout << ans[k].second << ' ';
  return 0;
}
