#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  long long int cnt;
  node* ch[2];
  node() {
    cnt = 0;
    ch[0] = NULL;
    ch[1] = NULL;
  }
};
class Trie {
 public:
  node* root;
  Trie() { root = new node(); }
  void insert(long long int num) {
    bitset<32> bt = num;
    node* ptr = root;
    for (int i = 31; i >= 0; i--) {
      if (ptr->ch[bt[i]] == NULL) {
        ptr->ch[bt[i]] = new node();
      }
      ptr = ptr->ch[bt[i]];
      ptr->cnt++;
    }
  }
  long long int find(long long int num) {
    bitset<32> bt = num;
    bitset<32> ret;
    node* ptr = root;
    for (int i = 31; i >= 0; i--) {
      if (ptr->ch[bt[i]] == NULL or ptr->ch[bt[i]]->cnt <= 0) {
        ptr = ptr->ch[!bt[i]];
        ret[i] = !bt[i];
      } else {
        ptr = ptr->ch[bt[i]];
        ret[i] = bt[i];
      }
      ptr->cnt--;
    }
    return ret.to_ulong();
  }
};
int main() {
  ios::sync_with_stdio(false);
  Trie* myt = new Trie();
  long long int n, i;
  cin >> n;
  long long int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    myt->insert(x);
  }
  for (int i = 0; i < n; i++) {
    long long int ans = (myt->find(arr[i]));
    ans ^= arr[i];
    cout << ans << " ";
  }
  cout << "\n";
  return 0;
}
