#include <bits/stdc++.h>
using namespace std;
const int md = 1e6 + 10;
int counter = 0;
int n, a[301000], p[300100];
struct trie {
  struct trie* lft;
  struct trie* rht;
  int cnt;
};
struct trie* newTrie() {
  struct trie* tmp = (struct trie*)(malloc(sizeof(struct trie*)));
  tmp->lft = NULL;
  tmp->rht = NULL;
  tmp->cnt = 0;
  return tmp;
}
struct trie *ptr, *root;
void insert(int num) {
  ptr = root;
  ptr->cnt++;
  for (int i = 29; i >= 0; i--) {
    if ((num >> i) & 1) {
      if (ptr->rht == NULL) ptr->rht = newTrie();
      ptr = ptr->rht;
      ptr->cnt++;
    } else {
      if (ptr->lft == NULL) ptr->lft = newTrie();
      ptr = ptr->lft;
      ptr->cnt++;
    }
  }
}
int srch(int num) {
  int res = 0;
  ptr = root;
  ptr->cnt--;
  for (int i = 29; i >= 0; i--) {
    res <<= 1;
    if ((num >> i) & 1) {
      if (ptr->rht == NULL || ptr->rht->cnt <= 0)
        ptr = ptr->lft, res |= 1;
      else
        ptr = ptr->rht;
    } else {
      if (ptr->lft == NULL || ptr->lft->cnt <= 0)
        ptr = ptr->rht, res |= 1;
      else
        ptr = ptr->lft;
    }
    ptr->cnt--;
  }
  return res;
}
int main() {
  root = newTrie();
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n; ++i) {
    insert(p[i]);
  }
  for (int i = 0; i < n; ++i) {
    cout << srch(a[i]) << " ";
  }
  return 0;
}
