#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
struct trie {
  long long child[2];
  long long have[2];
} a[N * 16];
string check;
long long b[N];
long long ans, n, k, cnt;
void update(long long num, long long pos, long long p) {
  long long bit = (num >> pos) & 1;
  if (a[p].child[bit] == 0 && a[p].have[bit] == 0) {
    a[p].child[bit] = ++cnt;
  }
  a[p].have[bit]++;
  if (pos == 0) return;
  update(num, pos - 1, a[p].child[bit]);
}
void get(long long num, long long pos, long long p) {
  long long bit = (num >> pos) & 1, check = 0;
  if (a[p].have[bit] == 0) {
    a[p].have[1 - bit]--;
    ans ^= (1 << pos);
    if (pos == 0) return;
    get(num, pos - 1, a[p].child[1 - bit]);
    return;
  }
  a[p].have[bit]--;
  if (pos == 0) return;
  get(num, pos - 1, a[p].child[bit]);
}
void erase(long long num, long long pos, long long p) {
  long long bit = (num >> pos) & 1;
  a[p].have[bit]--;
  if (pos == 0) return;
  erase(num, pos - 1, a[p].child[bit]);
}
signed main() {
  long long n, x;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> b[i];
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    update(x, 30, 0);
  }
  for (long long i = 1; i <= n; i++) {
    ans = 0;
    check = "";
    get(b[i], 30, 0);
    cout << ans << " ";
  }
}
