#include <bits/stdc++.h>
using namespace std;
multiset<int> p;
int a[300000], b[300000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    p.insert(t);
  }
  for (int i = 0; i < n; i++) {
    int ms = 0;
    for (int j = 29; j >= 0; j--) {
      ms |= a[i] & (1 << j);
      auto t = p.lower_bound(ms);
      if (t == p.end() || ((*t ^ ms) >> j)) ms ^= 1 << j;
    }
    auto t = p.find(ms), tp = t;
    p.erase(t, ++tp);
    b[i] = a[i] ^ ms;
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  return 0;
}
