#include <bits/stdc++.h>
using namespace std;
struct NODE {
  int node[9000010][2];
  int num[9000010];
  int root, l;
  int new_node() {
    node[l][0] = -1;
    node[l][1] = -1;
    l++;
    return l - 1;
  }
  void init() {
    l = 0;
    memset(num, 0, sizeof(num));
    root = new_node();
  }
  void Insert(int x[]) {
    int now = root;
    for (int i = 0; i < 30; i++) {
      if (node[now][x[i]] == -1) {
        node[now][x[i]] = new_node();
      }
      now = node[now][x[i]];
      num[now]++;
    }
  }
  int solve(int x[]) {
    int now = root;
    int res = 0;
    for (int i = 0; i < 30; i++) {
      res = res * 2;
      if (node[now][x[i]] != -1 && num[node[now][x[i]]] != 0) {
        num[node[now][x[i]]]--;
        now = node[now][x[i]];
      } else {
        res++;
        num[node[now][x[i] ^ 1]]--;
        now = node[now][x[i] ^ 1];
      }
    }
    return res;
  }
  void debug() {
    for (int i = 0; i < l; i++) printf("%d.......%d....\n", i, num[i]);
  }
};
int n;
int a[300010];
int b[30];
NODE trie;
int num;
int main() {
  while (scanf("%d", &n) != EOF) {
    trie.init();
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; i++) {
      scanf("%d", &num);
      memset(b, 0, sizeof(b));
      int cnt = 29;
      while (num) {
        b[cnt] = num % 2;
        num /= 2;
        cnt--;
      }
      trie.Insert(b);
    }
    for (int i = 0; i < n; i++) {
      memset(b, 0, sizeof(b));
      int cnt = 29;
      while (a[i]) {
        b[cnt] = a[i] % 2;
        a[i] /= 2;
        cnt--;
      }
      if (i) printf(" ");
      printf("%d", trie.solve(b));
    }
    printf("\n");
  }
  return 0;
}
