#include <bits/stdc++.h>
using namespace std;
struct node {
  int value;
  node *go[2];
};
node *newnode() {
  node *p = (node *)malloc(sizeof(node));
  p->go[0] = NULL;
  p->go[1] = NULL;
  p->value = -1;
  return p;
}
int search_xormin(node *root, int n) {
  node *ptr = root;
  int tmp[33] = {0}, c = 0, x, val;
  x = n;
  while (n != 0) {
    tmp[c++] = n % 2;
    n /= 2;
  }
  for (int i = 32; i >= 0; --i) {
    val = tmp[i];
    if (ptr->go[val] != NULL)
      ptr = ptr->go[val];
    else
      ptr = ptr->go[1 - val];
  }
  return ptr->value;
}
void del(node *root, int n) {
  node *ptr = root;
  node *delpp;
  int tmp[33] = {0}, c = 0, x, val, delv;
  x = n;
  while (n != 0) {
    tmp[c++] = n % 2;
    n /= 2;
  }
  delpp = ptr;
  delv = (ptr->go[tmp[31]] != NULL) ? tmp[31] : 1 - tmp[31];
  for (int i = 32; i >= 0; --i) {
    val = tmp[i];
    if (ptr->go[1 - val] != NULL) {
      delpp = ptr;
      delv = val;
    }
    ptr = ptr->go[val];
  }
  delpp->go[delv] = NULL;
}
void insert(node *root, int n) {
  node *ptr = root;
  int tmp[33] = {0}, c = 0, x, val;
  x = n;
  while (n != 0) {
    tmp[c++] = n % 2;
    n /= 2;
  }
  for (int i = 32; i >= 0; --i) {
    val = tmp[i];
    if (ptr->go[val] != NULL)
      ptr = ptr->go[val];
    else {
      node *temp = newnode();
      ptr->go[val] = temp;
      ptr = ptr->go[val];
    }
  }
  ptr->value = x;
}
int main() {
  int n, P[300005], A[300005], x;
  map<int, int> freq;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  node *root = newnode();
  for (int i = 0; i < n; ++i) {
    cin >> P[i];
    insert(root, P[i]);
    freq[P[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    x = search_xormin(root, A[i]);
    freq[x]--;
    if (freq[x] == 0) del(root, x);
    cout << (A[i] ^ x) << " ";
  }
}
