#include <bits/stdc++.h>
using namespace std;
long long inf = 200000000000;
long long leafcount[10000000];
vector<pair<long long, long long>> trie;
long long MAXBIT = 32;
void insert(long long num) {
  long long current = 0;
  for (long long i = MAXBIT; i >= 0; i--) {
    if ((num & (1ll << i)) >= 1) {
      if (trie[current].second == -1) {
        trie.push_back({-1, -1});
        trie[current].second = trie.size() - 1;
      }
      current = trie[current].second;
    } else {
      if (trie[current].first == -1) {
        trie.push_back({-1, -1});
        trie[current].first = trie.size() - 1;
      }
      current = trie[current].first;
    }
  }
  leafcount[current]++;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n], perm[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  trie.push_back({-1, -1});
  for (long long i = 0; i < n; i++) {
    cin >> perm[i];
    insert(perm[i]);
  }
  vector<long long> ans(n);
  for (long long i = 0; i < n; i++) {
    long long current = 0;
    long long branch = -1, branchdelete = -1;
    long long num = 0;
    for (long long j = MAXBIT; j >= 0; j--) {
      long long zero = inf, one = inf;
      if (trie[current].first != -1) {
        zero = (arr[i] ^ (0ll << j));
      }
      if (trie[current].second != -1) {
        one = (arr[i] ^ (1ll << j));
      }
      long long chosen, prev = current;
      if (one > zero) {
        chosen = 0;
        current = trie[current].first;
      } else {
        chosen = 1;
        num |= 1ll << j;
        current = trie[current].second;
      }
      if (one != inf && zero != inf) {
        branch = prev;
        branchdelete = chosen;
      }
    }
    if (branchdelete == 0) {
      leafcount[current]--;
      if (leafcount[current] == 0) trie[branch].first = -1;
    } else if (branchdelete == 1) {
      leafcount[current]--;
      if (leafcount[current] == 0) trie[branch].second = -1;
    }
    ans[i] = arr[i] ^ num;
  }
  for (auto x : ans) cout << x << " ";
  cout << "\n";
}
