#include <bits/stdc++.h>
using namespace std;
const int mod = 10e9 + 7;
int inp[300010];
int trie[10001010][2], trie_ct[10001010][2], trie_pt = 1;
string to_binary(int a) { return bitset<32>(a).to_string(); }
void add_string(string a, int val) {
  int len = a.size();
  for (int i = 0, j = 0; i < len; i++) {
    if (!trie[j][a[i] - '0']) {
      trie[j][a[i] - '0'] = trie_pt++;
    }
    trie_ct[j][a[i] - '0'] += val;
    j = trie[j][a[i] - '0'];
  }
}
long find_min(string a) {
  int len = a.size();
  for (int i = 0, j = 0; i < len; i++) {
    if (trie_ct[j][a[i] - '0'] <= 0) {
      a[i] = '0' + ((a[i] - '0' + 1) % 2);
    }
    j = trie[j][a[i] - '0'];
  }
  add_string(a, -1);
  return strtol(a.c_str(), NULL, 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, per;
  string temp;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> inp[i];
  for (int i = 0; i < n; ++i) {
    cin >> per;
    temp = to_binary(per);
    add_string(temp, 1);
  }
  for (int i = 0; i < n; ++i) {
    cout << (((long)inp[i]) ^ find_min(to_binary(inp[i]))) << " ";
  }
  cout << endl;
  return 0;
}
