#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const int mod = 1e9 + 7;
inline int read() {
  char c = getchar();
  int t = 0, f = 1;
  while (!isdigit(c)) f = (c == '-') ? -1 : 1, c = getchar();
  while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
  return t * f;
}
int a[N];
int trie[2][10 * N], cnt[2][10 * N];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  int t = 1;
  for (int i = 1; i <= n; i++) {
    int x = read();
    int id = 1;
    for (int j = 30; j >= 0; j--) {
      bool bit = 0;
      if (x & (1 << j)) bit = 1;
      if (!trie[bit][id]) trie[bit][id] = ++t;
      cnt[bit][id]++;
      id = trie[bit][id];
    }
  }
  for (int i = 1; i <= n; i++) {
    int y = 0, x = a[i];
    int id = 1;
    for (int j = 30; j >= 0; j--) {
      bool bit = 0;
      if (x & (1 << j)) bit = 1;
      if (cnt[bit][id]) {
        cnt[bit][id]--;
        if (bit) y |= (1 << j);
      } else {
        bit ^= 1;
        cnt[bit][id]--;
        if (bit) y |= (1 << j);
      }
      id = trie[bit][id];
    }
    cout << (y ^ x) << " ";
  }
}
