#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300050;
int n, A[MAXN], P[MAXN], trie[MAXN * 32][2], f[MAXN * 32], nxt;
void insert(int v) {
  int node = 0;
  for (int i = 29; i >= 0; i--) {
    int b = (v & (1 << i)) ? 1 : 0;
    f[node]++;
    if (trie[node][b] == -1) {
      node = trie[node][b] = ++nxt;
    } else {
      node = trie[node][b];
    }
  }
  f[node]++;
}
void remove(int v) {
  int node = 0;
  for (int i = 29; i >= 0; i--) {
    int b = (v & (1 << i)) ? 1 : 0;
    f[node]--;
    int to = trie[node][b];
    if (to == -1) {
      assert(false);
    } else {
      if (f[to] == 1) {
        trie[node][b] = -1;
      }
      node = to;
    }
  }
  f[node]--;
}
int closest(int v) {
  int node = 0, ans = 0;
  for (int i = 29; i >= 0; i--) {
    int b = (v & (1 << i)) ? 1 : 0;
    if (trie[node][b] == -1) {
      assert(trie[node][!b] != -1);
      node = trie[node][!b];
      if (!b) {
        ans += (1 << i);
      }
    } else {
      node = trie[node][b];
      if (b) {
        ans += (1 << i);
      }
    }
  }
  return ans;
}
int main() {
  while (scanf("%d", &n) >= 1) {
    memset(f, 0, sizeof(f));
    memset(trie, -1, sizeof(trie));
    nxt = 0;
    for (int i = (0); i < (int)(n); i++) {
      scanf("%d", &A[i]);
    }
    for (int i = (0); i < (int)(n); i++) {
      scanf("%d", &P[i]);
      insert(P[i]);
    }
    for (int i = (0); i < (int)(n); i++) {
      if (i) printf(" ");
      int c = closest(A[i]);
      printf("%d", A[i] ^ c);
      remove(c);
    }
    puts("");
    assert(trie[0][0] == -1);
    assert(trie[0][1] == -1);
  }
  return 0;
}
