#include <bits/stdc++.h>
using namespace std;
long long trie[10005000][2];
long long cnt[10005000];
long long sz = 1;
void insert(long long x) {
  long long t = 0;
  for (long long int i = 30; i >= 0; i--) {
    long long p = (x & (1 << i)) != 0;
    if (trie[t][p] == -1) trie[t][p] = sz++;
    cnt[t]++;
    t = trie[t][p];
  }
  cnt[t]++;
}
void remove(long long x) {
  long long t = 0;
  for (long long int i = 30; i >= 0; i--) {
    long long p = (x & (1 << i)) != 0;
    cnt[t]--;
    t = trie[t][p];
  }
  cnt[t]--;
}
pair<long long int, long long int> query(long long x) {
  long long t = 0;
  long long ans = 0, a = 0;
  long long ok;
  for (long long int i = 30; i >= 0; i--) {
    long long p = (x & (1 << i)) != 0;
    ok = 1;
    if (cnt[trie[t][p]] > 0) {
      ok = 0;
      a += p << i;
      t = trie[t][p];
    } else {
      a += (p ^ 1) << i;
      t = trie[t][p ^ 1];
    }
    if (ok) ans += 1 << i;
  }
  return {ans, a};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    memset(trie, -1, sizeof(trie));
    long long n;
    cin >> n;
    vector<long long int> a(n), p(n);
    for (long long int i = 0; i < n; i++) cin >> a[i];
    for (long long int i = 0; i < n; i++) {
      cin >> p[i];
      insert(p[i]);
    }
    vector<long long int> as(n);
    pair<long long int, long long int> tp;
    for (long long int i = 0; i < n; i++) {
      tp = query(a[i]);
      as[i] = tp.first;
      remove(tp.second);
    }
    for (long long int i = 0; i < n; i++) cout << as[i] << " ";
  }
  return 0;
}
