#include <bits/stdc++.h>
using namespace std;
struct Trie {
  int son[2], num;
  Trie() {
    memset(son, -1, sizeof son);
    num = 0;
  }
} trie[300010 * 31];
int cnt = 1;
int a[300010];
void Insert(int x) {
  int dep = 30, now = 1;
  trie[now].num++;
  while (dep >= 0) {
    int t = (x >> dep) & 1;
    if (trie[now].son[t] == -1) trie[now].son[t] = ++cnt;
    now = trie[now].son[t];
    trie[now].num++;
    dep--;
  }
}
int Find(int x) {
  int dep = 30, now = 1, ans = 0;
  trie[now].num--;
  while (dep >= 0) {
    int t = (x >> dep) & 1, g = now;
    if (trie[now].son[t] == -1) {
      now = trie[now].son[t ^ 1];
      trie[now].num--;
      if (!trie[now].num) trie[g].son[t ^ 1] = -1;
      ans += (t ^ 1) * (1 << dep);
    } else {
      now = trie[now].son[t];
      trie[now].num--;
      if (!trie[now].num) trie[g].son[t] = -1;
      ans += t * (1 << dep);
    }
    dep--;
  }
  return ans;
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    Insert(x);
  }
  for (int i = 1; i <= n; i++) {
    int t = Find(a[i]);
    printf("%d ", a[i] ^ t);
  }
  printf("\n");
  return 0;
}
