#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int L = 31;
int a[300005];
int p[300005];
int bits[50];
struct trie {
  trie* nt[2];
  int v;
  int sz[2];
  trie() {
    nt[0] = nt[1] = NULL;
    v = 0;
    sz[0] = sz[1] = 0;
  }
};
trie* root = new trie();
void insert(trie* cur, int idx) {
  if (idx == -1)
    cur->v++;
  else {
    int b = bits[idx];
    if (cur->nt[b] == NULL) cur->nt[b] = new trie();
    insert(cur->nt[b], idx - 1);
    if (idx == 0)
      cur->sz[b] = cur->nt[b]->v;
    else
      cur->sz[b] = cur->nt[b]->sz[0] + cur->nt[b]->sz[1];
  }
}
long long val = 0;
int ri = 0;
void query(trie* cur, int idx) {
  if (idx == -1)
    cur->v--;
  else {
    int b = bits[idx];
    if (cur->nt[b] == NULL)
      b = 1 - b;
    else if (cur->sz[b] == 0)
      b = 1 - b;
    if (bits[idx] != b) val += (1ll << idx);
    query(cur->nt[b], idx - 1);
    if (idx == 0)
      cur->sz[b] = cur->nt[b]->v;
    else
      cur->sz[b] = cur->nt[b]->sz[0] + cur->nt[b]->sz[1];
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    int x = p[i];
    for (int j = 0; j < L; j++) {
      bits[j] = x % 2;
      x /= 2;
    }
    insert(root, L - 1);
  }
  for (int i = 1; i <= n; i++) {
    int x = a[i];
    for (int j = 0; j < L; j++) {
      bits[j] = x % 2;
      x /= 2;
    }
    val = 0;
    query(root, L - 1);
    printf("%lld ", val);
  }
}
