#include <bits/stdc++.h>
using namespace std;
const bool print = false;
const int N = 9000005;
int trie[N][2], node[N], lengthS[N], a[300005], tree_len;
void add(int x, int val) {
  int node = 0;
  for (int i = 29; i >= 0; --i) {
    int bit = (x >> i) & 1;
    lengthS[node] += val;
    if (trie[node][bit] == 0) trie[node][bit] = ++tree_len;
    node = trie[node][bit];
  }
  lengthS[node] += val;
}
int getMin(int x) {
  int node = 0, ans = 0;
  for (int i = 29; i >= 0; --i) {
    int bit = (x >> i) & 1;
    if (trie[node][bit] == 0 || lengthS[trie[node][bit]] == 0) {
      ans += (1 ^ bit) << i;
      node = trie[node][1 ^ bit];
    } else {
      ans += bit << i;
      node = trie[node][bit];
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    add(x, 1);
  }
  for (int i = 1; i <= n; ++i) {
    cout << (a[i] ^ getMin(a[i])) << " ";
    add(getMin(a[i]), -1);
  }
}
