#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 3e5 + 7;
const int M = 5e6 + 7;
struct node {
  int cnt, son[2];
  node() { son[0] = son[1] = 0; }
} tire[N * 20];
int num = 1, a[N];
void insert(int val) {
  int root = 1;
  tire[root].cnt++;
  for (int i = 30; ~i; --i) {
    int son = (val >> i) & 1;
    if (!tire[root].son[son]) tire[root].son[son] = ++num;
    root = tire[root].son[son];
    tire[root].cnt++;
  }
}
int query(int val) {
  int root = 1, ans = 0;
  for (int i = 30; ~i; --i) {
    int son = (val >> i) & 1;
    if (!tire[tire[root].son[son]].cnt) son ^= 1;
    ans = (ans << 1) + son;
    root = tire[root].son[son];
    tire[root].cnt--;
  }
  return ans ^ val;
}
signed main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1, x; i <= n; i++) cin >> x, insert(x);
  for (int i = 1; i <= n; i++) cout << query(a[i]) << " ";
  cout << "\n";
  return 0;
}
