#include <bits/stdc++.h>
using namespace std;
class Node {
 public:
  Node *children;
  const int size = 2;
  int count;
  Node() {
    children = NULL;
    count = 0;
  }
  void grow(int k, int bit) {
    ++count;
    if (bit < 0) return;
    if (children == NULL) children = new Node[size];
    children[(k >> bit) & 1].grow(k, bit - 1);
  }
  int shrink(int k, int bit) {
    --count;
    if (bit < 0) return 0;
    int want = (k >> bit) & 1;
    if (!children[want].count) want = !want;
    int ret = children[want].shrink(k, bit - 1);
    return ret | (want << bit);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a[300001];
  cin >> n;
  Node trie = Node();
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    trie.grow(k, 30);
  }
  for (int i = 0; i < n; ++i) {
    cout << (trie.shrink(a[i], 30) ^ a[i]) << " ";
  }
  cout << endl;
  return 0;
}
