#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
struct trie {
  trie *next[2];
  int cnt;
  trie() {
    next[0] = next[1] = nullptr;
    cnt = 0;
  }
} * root;
int n;
int arr[N];
int perm[N];
void ubaci(int x) {
  trie *tmp = root;
  for (int i = 30; i >= 0; i--) {
    int sada = (1 << (i - 1)) & x;
    if (sada > 0)
      sada = 1;
    else
      sada = 0;
    if (tmp->next[sada] == nullptr) tmp->next[sada] = new trie();
    tmp->cnt++;
    tmp = tmp->next[sada];
  }
}
int find_smallest(int x, int pot = 30, trie *tmp = root, int ans = 0) {
  if (pot == 0) return ans;
  int sada = x & (1 << (pot - 1));
  if (sada > 0)
    sada = 1;
  else
    sada = 0;
  if (tmp->next[sada] != nullptr && (tmp->next[sada])->cnt > 0)
    return find_smallest(x, pot - 1, tmp->next[sada], ans * 2 + sada);
  else if (tmp->next[1 - sada] != nullptr)
    return find_smallest(x, pot - 1, tmp->next[1 - sada], ans * 2 + (1 - sada));
}
void izbaci(int x) {
  trie *tmp = root;
  for (int i = 30; i >= 0; i--) {
    int sada = x & (1 << (i - 1));
    if (sada > 0)
      sada = 1;
    else
      sada = 0;
    assert(tmp->next[sada] != nullptr);
    tmp->cnt -= 1;
    tmp = tmp->next[sada];
  }
}
int main() {
  root = new trie();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &perm[i]);
    ubaci(perm[i]);
  }
  for (int i = 0; i < n; i++) {
    int sol = find_smallest(arr[i]);
    izbaci(sol);
    printf("%d ", sol ^ arr[i]);
  }
  return 0;
}
