#include <bits/stdc++.h>
using namespace std;
const int N = 10000001;
int n, l[N], r[N], a[1000001], s[N], ind = 1;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1, x, y = 1; i <= n; i++) {
    scanf("%d", &x);
    y = 1;
    for (int i = 29; i >= 0; i--) {
      if (x & (1 << i)) {
        if (!r[y]) r[y] = (++ind);
        y = r[y];
      } else {
        if (!l[y]) l[y] = (++ind);
        y = l[y];
      }
      s[y]++;
    }
  }
  for (int j = 1, k, y; j <= n; j++) {
    k = 0;
    y = 1;
    for (int i = 29; i >= 0; i--) {
      if (a[j] & (1 << i)) {
        if (s[r[y]])
          y = r[y];
        else
          y = l[y], k ^= (1 << i);
      } else {
        if (s[l[y]])
          y = l[y];
        else
          y = r[y], k ^= (1 << i);
      }
      s[y]--;
    }
    printf("%d ", k);
  }
  return 0;
}
