#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, H = 1 << 30;
struct trie {
  int size;
  trie *n0, *n1;
  trie() {
    size = 0;
    n0 = n1 = NULL;
  }
};
int n, a[N];
void insert(trie* t, int x, int b) {
  while (b) {
    t->size++;
    if (x & b) {
      if (t->n1 == NULL) t->n1 = new trie;
      t = t->n1;
    } else {
      if (t->n0 == NULL) t->n0 = new trie;
      t = t->n0;
    }
    b >>= 1;
  }
  t->size++;
}
void erase(trie* t, int x, int b) {
  while (b) {
    t->size--;
    if (x & b)
      t = t->n1;
    else
      t = t->n0;
    b >>= 1;
  }
  t->size--;
}
int main() {
  int i, x, b;
  trie* t = new trie;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", a + i);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    insert(t, x, H);
  }
  for (i = 0; i < n; i++) {
    trie* it = t;
    x = 0;
    for (b = H; b; b >>= 1) {
      if (a[i] & b) {
        if (it->n1 == NULL || it->n1->size == 0)
          it = it->n0;
        else {
          it = it->n1;
          x |= b;
        }
      } else {
        if (it->n0 == NULL || it->n0->size == 0) {
          it = it->n1;
          x |= b;
        } else
          it = it->n0;
      }
    }
    printf("%d ", a[i] ^ x);
    erase(t, x, H);
  }
  return 0;
}
