#include <bits/stdc++.h>
using namespace std;
const int N = 31;
const int K = 2;
struct Vertex {
  int next[K];
  int value;
  Vertex() {
    fill(begin(next), end(next), -1);
    value = 0;
  }
};
vector<Vertex> trie(1);
void add_string(long long int x) {
  int v = 0;
  for (long long int i = N; i >= 0; i--) {
    long long int temp = 1LL << i;
    long long int c = temp & x;
    if (c != 0) c = 1;
    if (trie[v].next[c] == -1) {
      trie[v].next[c] = trie.size();
      trie.emplace_back();
    }
    v = trie[v].next[c];
    trie[v].value++;
  }
}
void remove(long long int x) {
  int v = 0;
  for (long long int i = N; i >= 0; i--) {
    long long int temp = 1LL << i;
    long long int c = temp & x;
    if (c != 0) c = 1;
    v = trie[v].next[c];
    trie[v].value--;
  }
}
long long int query(long long int x) {
  long long int ans = 0;
  long long int v = 0;
  for (long long int i = N; i >= 0; i--) {
    long long int temp = 1LL << i;
    long long int c = temp & x;
    if (c != 0) c = 1;
    if (trie[v].next[c] != -1 && trie[trie[v].next[c]].value > 0) {
      v = trie[v].next[c];
      continue;
    }
    c ^= 1;
    if (trie[v].next[c] != -1 && trie[trie[v].next[c]].value > 0) {
      ans += temp;
      v = trie[v].next[c];
    } else
      break;
  }
  return ans;
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
    add_string(b[i]);
  }
  for (long long int i = 0; i < n; i++) {
    long long int ans = query(a[i]);
    cout << ans << " ";
    long long int dig = a[i] ^ ans;
    remove(dig);
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
}
