#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const double EPS = (double)1e-9;
const double PI = (double)acos(-1.0);
const long long MOD = (long long)1e9 + 7;
int irand(int lo, int hi) {
  return (((double)rand()) / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
string toString(long long x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
long long toNumber(string S) {
  long long ret;
  sscanf(S.c_str(), "%lld", &ret);
  return ret;
}
void syncOff() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
int ar1[(int)2e5 + 5];
pair<int, int> ar2[(int)2e5 + 5];
int main() {
  syncOff();
  int m, x;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> ar1[i];
  for (int i = 0; i < m; i++) {
    cin >> x;
    ar2[i] = make_pair(x, i);
  }
  sort(ar1, ar1 + m);
  sort(ar2, ar2 + m);
  int res[(int)2e5 + 5];
  for (int i = 0; i < m; i++) {
    res[ar2[i].second] = ar1[m - i - 1];
  }
  for (int i = 0; i < m; i++) {
    if (i > 0) cout << " ";
    cout << res[i];
  }
  cout << endl;
  return 0;
}
