#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int m[N], k[N];
namespace trie {
const int CHILD = 2;
struct Node {
  Node *next[CHILD];
  int counter[CHILD];
  Node() {
    for (int i = 0; i < CHILD; i++) {
      next[i] = NULL;
      counter[i] = 0;
    }
  }
} * root;
void insert(long long val) {
  Node *cur = root;
  for (int i = 33; i >= 0; i--) {
    bool bit = val & (1LL << i);
    if (cur->next[bit] == NULL) {
      cur->next[bit] = new Node();
    }
    cur->counter[bit]++;
    cur = cur->next[bit];
  }
}
void erase(long long val) {
  Node *cur = root;
  for (int i = 33; i >= 0; i--) {
    bool bit = val & (1LL << i);
    if (cur->next[bit] == NULL) {
      cur->next[bit] = new Node();
    }
    cur->counter[bit]--;
    cur = cur->next[bit];
  }
}
long long query(long long val) {
  Node *cur = root;
  long long res = 0;
  for (int i = 33; i >= 0; i--) {
    bool bit = (val & (1LL << i));
    if (cur->next[bit] == NULL || cur->counter[bit] == 0) {
      bit = !bit;
    }
    res = (res << 1) + bit;
    cur = cur->next[bit];
  }
  return res;
}
}  // namespace trie
int main() {
  int n;
  trie::root = new trie::Node();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &m[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &k[i]);
    trie::insert(k[i]);
  }
  for (int i = 0; i < n; i++) {
    long long res = trie::query(m[i]);
    trie::erase(res);
    printf("%lld\n", res ^ m[i]);
  }
  return 0;
}
