#include <bits/stdc++.h>
int a[300005], b[300005];
int tree[300005 * 31][2], num[300005 * 31], tot;
void insert(int x) {
  int now = 0;
  for (int i = 30; i >= 0; i--) {
    int state = (x & (1 << i)) > 0;
    if (!tree[now][state]) tree[now][state] = ++tot;
    now = tree[now][state];
    num[now]++;
  }
}
int query(int x) {
  int now = 0, ans = 0;
  for (int i = 30; i >= 0; i--) {
    int state = (x & (1 << i)) > 0;
    if (num[tree[now][state]])
      now = tree[now][state], num[now]--;
    else
      ans |= (1 << i), now = tree[now][state ^ 1], num[now]--;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    insert(b[i]);
  }
  for (int i = 0; i < n; i++) printf("%d ", query(a[i]));
  printf("\n");
}
