#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 100;
int trie[maxn * 30][2], cnt[maxn * 30], tot = 0;
void insert(int x) {
  int u = 0;
  for (int i = 30; i >= 0; --i) {
    int tp = ((x >> i) & 1);
    if (!trie[u][tp]) trie[u][tp] = ++tot;
    u = trie[u][tp];
    cnt[u]++;
  }
}
void find(int x) {
  int u = 0;
  bitset<391> b;
  for (int i = 30; i >= 0; --i) {
    int tp = ((x >> i) & 1);
    int v = u;
    if (trie[u][tp]) {
      u = trie[u][tp];
      cnt[u]--;
      if (!cnt[u]) trie[v][tp] = 0;
    } else if (trie[u][tp ^ 1]) {
      u = trie[u][tp ^ 1];
      cnt[u]--;
      if (!cnt[u]) trie[v][tp ^ 1] = 0;
      b[i] = 1;
    }
  }
  printf("%d ", b.to_ulong());
}
int a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    insert(x);
  }
  for (int i = 1; i <= n; ++i) find(a[i]);
  puts("");
  return 0;
}
