#include <bits/stdc++.h>
using namespace std;
const int mn = 3e5 + 5;
const int mm = 1e7;
int n;
int a[mn];
int p[mn];
int ch[mm][2];
int c[mm];
int val[mm];
int sz = 1;
int t[35];
void insert() {
  int u = 0;
  for (int i = 30; i; i--) {
    int c = t[i];
    if (!ch[u][c]) {
      ch[sz][0] = ch[sz][1] = 0;
      val[sz] = 0;
      ch[u][c] = sz++;
    }
    u = ch[u][c];
    val[u]++;
  }
}
int query() {
  int u = 0, s = 0;
  for (int i = 30; i; i--) {
    int c = t[i];
    if (!ch[u][c] || !val[ch[u][c]]) {
      c ^= 1;
    }
    s += (1 << (i - 1)) * c;
    u = ch[u][c];
    val[u]--;
  }
  return s;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    int u;
    scanf("%d", &u);
    int cnt = 0;
    memset(t, 0, sizeof(t));
    while (u) t[++cnt] = u % 2, u /= 2;
    insert();
  }
  for (int i = 1; i <= n; i++) {
    int u = a[i];
    int cnt = 0;
    memset(t, 0, sizeof(t));
    while (u) t[++cnt] = u % 2, u /= 2;
    int v = query();
    printf("%d ", v ^ a[i]);
  }
  return 0;
}
