#include <bits/stdc++.h>
struct trie {
  int id;
  trie *next[2];
  trie() : next{}, id(0) {}
} * rootTrie;
void insertTrie(int x) {
  trie *curr = rootTrie;
  for (int i = 30; i >= 0; i--) {
    int p = (x >> i) & 1;
    if (curr->next[p] == 0) curr->next[p] = new trie();
    curr = curr->next[p];
    curr->id++;
  }
}
int findMin(int x) {
  int ans = 0;
  trie *curr = rootTrie;
  for (int i = 30; i >= 0; i--) {
    int p = (x >> i) & 1;
    if (curr->next[p] == 0 || curr->next[p]->id == 0) {
      curr = curr->next[p ^ 1];
      ans += (1 << i);
    } else
      curr = curr->next[p];
    curr->id--;
  }
  return ans;
}
void delTrie(trie *curr) {
  if (!curr) return;
  delTrie(curr->next[0]);
  delTrie(curr->next[1]);
  delete curr;
  curr = NULL;
}
int main() {
  int *arr, n;
  rootTrie = new trie();
  scanf("%d", &n);
  arr = (int *)malloc(sizeof(int) * n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int x, i = 0; i < n; i++) scanf("%d", &x), insertTrie(x);
  for (int i = 0; i < n; i++) printf("%d ", findMin(arr[i]));
  delTrie(rootTrie);
  return 0;
}
