#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
int n, a[MAXN], b[MAXN], c[31];
struct Node {
  int cnt;
  Node *next[2];
} * trie;
Node *getNode() {
  Node *pNode = new Node;
  pNode->cnt = 0;
  for (int i = 0; i < (2); i++) pNode->next[i] = NULL;
  return pNode;
}
void add(int x) {
  for (int i = 0; i < (30); i++) c[i] = x & 1, x >>= 1;
  Node *pNode = trie;
  for (int i = (30) - 1; i >= 0; i--) {
    if (!pNode->next[c[i]]) pNode->next[c[i]] = getNode();
    pNode = pNode->next[c[i]];
    pNode->cnt++;
  }
}
void get(int x) {
  for (int i = 0; i < (30); i++) c[i] = x & 1, x >>= 1;
  Node *pNode = trie;
  int res = 0;
  for (int i = (30) - 1; i >= 0; i--) {
    int x;
    res <<= 1;
    if (!pNode->next[c[i]] || !pNode->next[c[i]]->cnt) {
      x = 1 - c[i], res++;
    } else
      x = c[i];
    pNode = pNode->next[x];
    pNode->cnt--;
  }
  cout << res << " ";
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  for (int i = (1); i <= (n); i++) scanf("%d", &b[i]);
  trie = getNode();
  for (int i = (1); i <= (n); i++) add(b[i]);
  for (int i = (1); i <= (n); i++) get(a[i]);
  return 0;
}
