#include <bits/stdc++.h>
using namespace std;
struct trie {
  trie* bit[2];
  long long num = 0;
};
trie* root;
void insert(long long x) {
  trie* curr = root;
  for (long long i = 30; i >= 0; i--) {
    long long b = (x >> i) & 1;
    if (curr->bit[b] == NULL) curr->bit[b] = new trie();
    curr = curr->bit[b];
    curr->num++;
  }
}
void remove(long long x) {
  trie* curr = root;
  for (long long i = 30; i >= 0; i--) {
    long long b = (x >> i) & 1;
    curr = curr->bit[b];
    curr->num--;
  }
}
long long min_xor(long long x) {
  long long ans = 0;
  trie* curr = root;
  for (long long i = 30; i >= 0; i--) {
    long long b = (x >> i) & 1;
    if (curr->bit[b] != NULL && curr->bit[b]->num > 0)
      curr = curr->bit[b];
    else {
      ans += (1 << i);
      curr = curr->bit[!b];
    }
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  root = new trie();
  long long n;
  cin >> n;
  vector<long long> v(n), p(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < n; i++) cin >> p[i];
  for (long long i = 0; i < n; i++) insert(p[i]);
  for (long long i = 0; i < n; i++) {
    long long ans = min_xor(v[i]);
    cout << min_xor(v[i]) << " ";
    remove(ans ^ v[i]);
  }
  return 0;
}
