#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
const int B = 30;
const int mod = 1e9 + 7;
int tot;
int a[N], b[N], trie[N * B][2], cnt[N * B][2];
void add(int n) {
  int cur = 0;
  for (int i = B - 1; i >= 0; i--) {
    int x = (n >> i) & 1;
    if (!trie[cur][x]) {
      trie[cur][x] = ++tot;
      cnt[cur][x]++;
    } else
      cnt[cur][x]++;
    cur = trie[cur][x];
  }
}
int best(int n) {
  int cur = 0, ans = 0;
  for (int i = B - 1; i >= 0; i--) {
    int x = (n >> i) & 1;
    if (!cnt[cur][x]) x ^= 1, ans |= (1 << i);
    cnt[cur][x]--;
    cur = trie[cur][x];
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) scanf("%d", b + i), add(b[i]);
  for (int i = 1; i <= n; i++) printf("%d ", best(a[i]));
  return 0;
}
