#include <bits/stdc++.h>
using namespace std;
int n, a[300005], numNodo;
int trie[300005 * 31][5], cnt[300005 * 31];
void addTrie(int x) {
  int u = 0;
  for (int i = 30; i >= 0; i--) {
    int aux = ((1 << i) & x) > 0;
    if (trie[u][aux] == 0) trie[u][aux] = ++numNodo;
    u = trie[u][aux];
    cnt[u]++;
  }
}
int solve(int x) {
  int u = 0, res = 0;
  for (int i = 30; i >= 0; i--) {
    int aux = ((1 << i) & x) > 0;
    if (cnt[trie[u][aux]])
      u = trie[u][aux], cnt[u]--;
    else
      res |= (1 << i), u = trie[u][aux ^ 1], cnt[u]--;
  }
  return res;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    addTrie(x);
  }
  vector<int> res;
  for (int i = 0; i < n; i++) res.push_back(solve(a[i]));
  for (int val : res) cout << val << " ";
  cout << endl;
  return 0;
}
