#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void rd(T& x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 3e5 + 5;
int n, nxt[N * 30][2], num[N * 30];
int a[N], pos = 1;
void insert(int x) {
  int now = 1;
  for (int i = 30; i >= 0; --i) {
    int v = (x >> i) & 1;
    if (!nxt[now][v]) nxt[now][v] = ++pos;
    now = nxt[now][v];
    num[now]++;
  }
}
inline void del(int x) {
  int now = 1;
  for (int i = 30; i >= 0; --i) {
    int v = (x >> i) & 1;
    now = nxt[now][v];
    num[now]--;
  }
}
int qu(int x) {
  int now = 1, ans = 0;
  for (int i = 30; i >= 0; --i) {
    int v = (x >> i) & 1;
    if (nxt[now][v] && num[nxt[now][v]]) {
      now = nxt[now][v];
    } else
      now = nxt[now][v ^ 1], v ^= 1;
    ans |= (v << i);
  }
  del(ans);
  return x ^ ans;
}
int main() {
  rd(n);
  for (int i = 1; i <= n; i++) rd(a[i]);
  for (int i = 1; i <= n; i++) {
    int x;
    rd(x);
    insert(x);
  }
  for (int i = 1; i <= n; i++) printf("%d ", qu(a[i]));
}
