#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long a[N], p[N];
long long n;
typedef struct data {
  long long cnt = 0;
  data* bit[2];
} trie;
trie* head;
void insert(long long x) {
  trie* cur = head;
  for (long long i = 31; i >= 0; i--) {
    long long b = (x >> i) & 1;
    if (!cur->bit[b]) cur->bit[b] = new trie();
    cur = cur->bit[b];
    cur->cnt++;
  }
}
void remove(long long x) {
  trie* cur = head;
  for (long long i = 31; i >= 0; i--) {
    long long b = (x >> i) & 1;
    cur = cur->bit[b];
    cur->cnt--;
  }
}
long long min_xor(long long x) {
  trie* cur = head;
  long long ans = 0;
  for (long long i = 31; i >= 0; i--) {
    long long b = (x >> i) & 1;
    if (cur->bit[b] && cur->bit[b]->cnt > 0) {
      cur = cur->bit[b];
    } else {
      ans += (1LL << i);
      cur = cur->bit[!b];
    }
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  head = new trie();
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    cin >> p[i];
    insert(p[i]);
  }
  for (long long i = 1; i <= n; i++) {
    long long val = min_xor(a[i]);
    remove(a[i] ^ val);
    cout << val << " ";
  }
  return 0;
}
