#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  multiset<long long> b;
  for (int i = 0; i < n; i++) cin >> a[i];
  int bb;
  for (int i = 0; i < n; i++) {
    cin >> bb;
    b.insert(bb);
  }
  vector<long long> poww(1, 1);
  for (int i = 1; i < 35; i++) {
    poww[i] = poww[i - 1] * 2;
  }
  auto l = b.begin();
  auto r = b.begin();
  auto nl = b.begin();
  auto nr = b.begin();
  for (int j = 0; j < n; j++) {
    l = b.begin();
    r = b.end();
    long long huh = 0;
    for (int i = 29; i >= 0; i--) {
      if ((a[j] & poww[i])) {
        nl = b.lower_bound(huh + poww[i]);
        nr = b.upper_bound(huh + 2 * poww[i] - 1);
        if (nl == nr) continue;
        huh += poww[i];
        l = nl;
        r = nr;
      } else {
        nl = b.lower_bound(huh);
        nr = b.upper_bound(huh + poww[i] - 1);
        if (nl == nr) {
          huh += poww[i];
          continue;
        }
        l = nl;
        r = nr;
      }
    }
    cout << (a[j] ^ (*l)) << " ";
    b.erase(l);
  }
  return 0;
}
