#include <bits/stdc++.h>
using namespace std;
const int maxn = 300004;
const int maxx = 30 * maxn;
int sz;
int trie[maxx][2], s[maxx];
int a[maxn], p[maxn];
void insert(int n) {
  int v = 0;
  for (int i = 29; i >= 0; i--) {
    int val = (n >> i) & 1;
    if (!trie[v][val]) trie[v][val] = ++sz;
    v = trie[v][val];
    ++s[v];
  }
}
int query(int n) {
  int v = 0;
  int res = 0;
  for (int i = 29; i >= 0; i--) {
    int val = (n >> i) & 1;
    if (!s[trie[v][val]]) val ^= 1;
    v = trie[v][val];
    --s[v];
    res = (res << 1) | val;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    insert(p[i]);
  }
  for (int i = 0; i < n; i++) {
    cout << (query(a[i]) ^ a[i]) << ' ';
  }
}
