#include <bits/stdc++.h>
using namespace std;
int A[300005], B[300005 * 32][2], S[300005 * 32], n, t, cnt;
void ingresoInt(int A[]) {
  for (int i = 0; i < n; ++i) scanf("%d", &A[i]);
}
void ingresoLL(long long A[]) {
  for (int i = 0; i < n; ++i) scanf("%lld", &A[i]);
}
void mostrarInt(int A[]) {
  for (int i = 0; i < n; ++i) printf("%d ", A[i]);
  printf("\n");
}
void mostrarLL(long long A[]) {
  for (int i = 0; i < n; ++i) printf("%lld ", A[i]);
  printf("\n");
}
void I(int x) {
  for (int i = 30, p = 0; i--;) {
    t = x >> i & 1;
    if (!B[p][t]) B[p][t] = ++cnt;
    p = B[p][t];
    ++S[p];
  }
}
int Q(int x) {
  int r = 0;
  for (int i = 30, p = 0; i--;) {
    t = x >> i & 1;
    if (S[B[p][t]])
      p = B[p][t];
    else
      p = B[p][t ^ 1], r += 1 << i;
    --S[p];
  }
  return r;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", A + i);
  for (int i = 1; i <= n; ++i) scanf("%d", &t), I(t);
  for (int i = 1; i <= n; ++i) printf("%d ", Q(A[i]));
  return !printf("\n");
}
