#include <bits/stdc++.h>
int n, a[300010], p, sum, trietree[9000000][2], mark[9000000];
void insert(int x, int id, int value) {
  if (value >= 1) {
    if (trietree[id][x / value] == 0) {
      sum++;
      trietree[id][x / value] = sum;
    }
    mark[trietree[id][x / value]]++;
    insert(x % value, trietree[id][x / value], value / 2);
  }
}
int match(int x, int id, int value) {
  if (value == 0) {
    return 0;
  } else {
    if (mark[trietree[id][x / value]] != 0) {
      int t = match(x % value, trietree[id][x / value], value / 2);
      mark[trietree[id][x / value]]--;
      return t;
    } else {
      int t = value + match(x % value, trietree[id][1 - x / value], value / 2);
      mark[trietree[id][1 - x / value]]--;
      return t;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p);
    insert(p, 0, 536870912);
  }
  for (int i = 1; i <= n; i++) {
    if (i != 1) printf(" ");
    printf("%d", match(a[i], 0, 536870912));
  }
  printf("\n");
  return 0;
}
