#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5 + 5;
const double INF = 0x3f3f3f3f;
const double EPS = 1e-6;
struct Trie {
  int rt, tot, node[MAX_N * 35][2], bk[MAX_N * 35], cnt[MAX_N * 35];
  void init() {
    tot = 0;
    memset(node, 0, sizeof(node));
    memset(bk, 0, sizeof(bk));
    memset(cnt, 0, sizeof(cnt));
    rt = ++tot;
  }
  void insert(int k) {
    int now = rt;
    for (int i = 29; i >= 0; --i) {
      int c = k >> i & 1;
      if (!node[now][c]) node[now][c] = ++tot;
      now = node[now][c];
    }
    bk[now] = k;
    ++cnt[now];
  }
  int find(int k) {
    int now = rt, lst = rt, dir = 0;
    for (int i = 29; i >= 0; --i) {
      int c = k >> i & 1;
      if (node[now][0] && node[now][1]) {
        lst = now;
        dir = c;
      }
      if (node[now][c]) {
        now = node[now][c];
      } else {
        now = node[now][c ^ 1];
      }
    }
    --cnt[now];
    if (cnt[now] == 0) node[lst][dir] = 0;
    return bk[now];
  }
} trie;
int n, a[MAX_N], p;
void solve() {
  trie.init();
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &p);
    trie.insert(p);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", trie.find(a[i]) ^ a[i]);
  }
}
int main() {
  solve();
  return 0;
}
