#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5;
const long long B = 30;
long long trie[N * B][2], cnt[N * B][2];
long long next_node = 1;
long long A[N], P[N];
void insert(long long val) {
  long long curr_node = 0;
  for (long long b = B; b >= 0; b--) {
    long long bit = (val >> b) & 1;
    if (!trie[curr_node][bit]) {
      trie[curr_node][bit] = next_node++;
    }
    cnt[curr_node][bit]++;
    curr_node = trie[curr_node][bit];
  }
  return;
}
void remove(long long val) {
  long long curr_node = 0;
  for (long long b = B; b >= 0; b--) {
    long long bit = (val >> b) & 1;
    cnt[curr_node][bit]--;
    curr_node = trie[curr_node][bit];
  }
  return;
}
long long min_xor(long long a) {
  long long curr_node = 0, minxor = 0;
  for (long long b = B; b >= 0; b--) {
    long long bit = (a >> b) & 1;
    if (cnt[curr_node][bit]) {
      curr_node = trie[curr_node][bit];
    } else {
      curr_node = trie[curr_node][!bit];
      minxor |= (1 << b);
    }
  }
  return minxor;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> P[i];
    insert(P[i]);
  }
  for (long long i = 0; i < n; i++) {
    long long minxor = min_xor(A[i]);
    cout << minxor << " ";
    remove(minxor ^ A[i]);
  }
  cout << "\n";
  return 0;
}
