#include <bits/stdc++.h>
using namespace std;
int n, a[300005], p[300005], trie[10000005][2], s[10000005], siz;
void insert(int v, int cur, int lv) {
  if (lv == -1) {
    s[cur]++;
    return;
  }
  int bits = (v & (1 << lv)) > 0;
  if (trie[cur][0] == -1) trie[cur][0] = ++siz;
  if (trie[cur][1] == -1) trie[cur][1] = ++siz;
  s[cur] -= s[trie[cur][bits]];
  insert(v, trie[cur][bits], lv - 1);
  s[cur] += s[trie[cur][bits]];
}
int query(int v, int cur, int lv, int now) {
  if (lv == -1) {
    s[cur]--;
    return now;
  }
  int bits = ((v & (1 << lv)) > 0);
  if (trie[cur][0] == -1) trie[cur][0] = ++siz;
  if (trie[cur][1] == -1) trie[cur][1] = ++siz;
  if (s[trie[cur][bits]] == 0) bits = 1 - bits;
  s[cur] -= s[trie[cur][bits]];
  int tmp = query(v, trie[cur][bits], lv - 1, now + bits * (1 << lv));
  s[cur] += s[trie[cur][bits]];
  return tmp;
}
int main() {
  memset(trie, -1, sizeof(trie));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    insert(x, 0, 29);
  }
  for (int i = 0; i < n; i++) {
    int x = query(a[i], 0, 29, 0);
    if (i == 0)
      printf("%d", a[i] ^ x);
    else
      printf(" %d", a[i] ^ x);
  }
  printf("\n");
}
