#include <bits/stdc++.h>
using namespace std;
using namespace std;
typedef struct data {
  data* bit[2] = {NULL};
  long long cnt = 0;
} trie;
trie* head = new trie();
void inser(long long x) {
  trie* cur = head;
  cur->cnt++;
  long long id = 31;
  while (id >= 0) {
    long long tm = ((1 << id) & x);
    if (tm > 0) {
      if (cur->bit[1] == NULL) {
        cur->bit[1] = new trie();
      }
      cur = cur->bit[1];
      cur->cnt++;
    } else {
      if (cur->bit[0] == NULL) {
        cur->bit[0] = new trie();
      }
      cur = cur->bit[0];
      cur->cnt++;
    }
    id--;
  }
}
long long quer(long long x) {
  trie* cur = head;
  long long an = 0;
  long long cc = 31;
  long long id = 31;
  while (id >= 0) {
    long long tm = ((1 << id) & x);
    if (tm == 0) {
      if (cur->bit[0] != NULL && cur->bit[0]->cnt > 0) {
        cur = cur->bit[0];
        cur->cnt--;
      } else if (cur->bit[1] != NULL && cur->bit[1]->cnt > 0) {
        an += pow(2, cc);
        cur = cur->bit[1];
        cur->cnt--;
      }
    } else {
      if (cur->bit[1] != NULL && cur->bit[1]->cnt > 0) {
        cur = cur->bit[1];
        cur->cnt--;
      } else if (cur->bit[0] != NULL && cur->bit[0]->cnt > 0) {
        an += pow(2, cc);
        cur = cur->bit[0];
        cur->cnt--;
      } else {
      }
    }
    id--;
    cc--;
  }
  return an;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    inser(b[i]);
  }
  for (long long i = 0; i < n; i++) {
    cout << quer(a[i]) << " ";
  }
  return 0;
}
