#include <bits/stdc++.h>
using namespace std;
int a[300005];
int trie[9000005][2];
int b[300005];
int num[9000005];
int sz;
void Insert(int x) {
  int u = 0;
  bool v;
  for (int i = 30; i >= 0; i--) {
    v = (1 << i) & x;
    if (trie[u][v] == 0) {
      trie[u][v] = ++sz;
    }
    u = trie[u][v];
    num[u]++;
  }
}
long long solve(int x) {
  int u = 0;
  bool v;
  long long ans = 0;
  for (int i = 30; i >= 0; i--) {
    v = (1 << i) & x;
    if (num[trie[u][v]]) {
      u = trie[u][v];
      num[u]--;
    } else {
      u = trie[u][!v];
      num[u]--;
      ans = ans ^ (1ll << i);
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    Insert(b[i]);
  }
  for (int i = 1; i <= n; i++) {
    cout << solve(a[i]) << " ";
  }
  return 0;
}
