#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300000;
const int BN = 30;
const int MAX_M = MAX_N * BN;
int as[MAX_N], ps[MAX_N];
int cs[MAX_M][2], ds[MAX_M];
void trie_add(int p, int &m) {
  int u = 0;
  ds[u]++;
  for (int i = BN - 1; i >= 0; i--) {
    int bi = ((p >> i) & 1);
    int v = cs[u][bi];
    if (v < 0) v = cs[u][bi] = m++;
    ds[v]++;
    u = v;
  }
}
void trie_del(int p) {
  int u = 0;
  ds[u]--;
  for (int i = BN - 1; i >= 0; i--) {
    int bi = ((p >> i) & 1);
    u = cs[u][bi];
    ds[u]--;
  }
}
int trie_find(int p) {
  int u = 0, q = 0;
  for (int i = BN - 1; i >= 0; i--) {
    int bi = ((p >> i) & 1);
    int v = cs[u][bi];
    if (v < 0 || ds[v] == 0) bi ^= 1, v = cs[u][bi];
    q |= (bi << i);
    u = v;
  }
  return q;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);
  int m = 1;
  memset(cs, -1, sizeof(cs));
  for (int i = 0; i < n; i++) {
    int pi;
    scanf("%d", &pi);
    trie_add(pi, m);
  }
  for (int i = 0; i < n; i++) {
    int qi = trie_find(as[i]);
    trie_del(qi);
    printf("%d%c", as[i] ^ qi, (i + 1 < n) ? ' ' : '\n');
  }
  return 0;
}
