#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e6 + 5;
const int b = 31;
const long long MOD = 1e9 + 7;
int n;
int mes[MAXN];
int trie[MAXN * 3][2];
int freq[MAXN * 3];
int ans[MAXN];
int nxtId = 2;
void insert(int val) {
  int id = 1;
  for (int i = b; i >= 0; i--) {
    bool on = (1 << i) & val;
    if (trie[id][on] == -1) trie[id][on] = nxtId++;
    id = trie[id][on];
    freq[id]++;
  }
}
void remove(int val) {
  int id = 1;
  for (int i = b; i >= 0; i--) {
    bool on = (1 << i) & val;
    id = trie[id][on];
    freq[id]--;
  }
}
int bestKey(int val) {
  int id = 1;
  int key = 0;
  for (int i = b; i >= 0; i--) {
    bool on = (1 << i) & val;
    bool bitOn = false;
    int child = trie[id][on];
    if (child != -1 && freq[child]) {
      id = trie[id][on];
      bitOn = on;
    } else {
      id = trie[id][!on];
      bitOn = !on;
    }
    if (bitOn) key |= (1 << i);
  }
  return key;
}
void solve() {
  cin >> n;
  memset(trie, -1, sizeof(trie));
  for (int i = 1; i <= n; i++) cin >> mes[i];
  int k;
  for (int i = 1; i <= n; i++) {
    cin >> k;
    insert(k);
  }
  for (int i = 1; i <= n; i++) {
    int key = bestKey(mes[i]);
    ans[i] = mes[i] ^ key;
    remove(key);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << '\n';
}
int main() { solve(); }
