#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    X = (X << 3) + (X << 1) + ch - '0', ch = getchar();
  return X * w;
}
int n, tot, a[300007], val[300007 * 30], trie[300007 * 30][2],
    cnt[300007 * 30][2];
void add(int x) {
  int cur = 0;
  for (int i = 29; i >= 0; i--) {
    int y = (x >> i) & 1;
    if (!trie[cur][y]) {
      trie[cur][y] = ++tot;
    }
    cnt[cur][y]++;
    cur = trie[cur][y];
  }
  val[cur] = x;
}
int ask(int x) {
  int cur = 0;
  for (int i = 29; i >= 0; i--) {
    int y = (x >> i) & 1;
    if (cnt[cur][y]) {
      cnt[cur][y]--;
      cur = trie[cur][y];
    } else {
      cnt[cur][y ^ 1]--;
      cur = trie[cur][y ^ 1];
    }
  }
  return val[cur];
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  for (int i = 1; i <= n; i++) {
    int x = read();
    add(x);
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i] ^ ask(a[i]));
  }
  return 0;
}
