#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) {
  long long z = y;
  while (x % y != 0) {
    z = x % y;
    x = y;
    y = z;
  }
  return z;
}
int T[300105 * 30][2], cnt, sz[300105 * 30];
int a[300105];
void add(int x) {
  int rt = 0;
  for (int i = 29; ~i; i--) {
    int num = (x >> i) & 1;
    if (T[rt][num] == 0) {
      T[rt][num] = ++cnt;
    }
    rt = T[rt][num];
    sz[rt]++;
  }
}
int fd(int x) {
  int rt = 0, ans = 0;
  for (int i = 29; ~i; i--) {
    int num = (x >> i) & 1;
    if (T[rt][num] != 0 && sz[T[rt][num]] != 0) {
      sz[T[rt][num]]--;
      rt = T[rt][num];
    } else {
      assert(T[rt][num ^ 1] != 0 && sz[T[rt][num ^ 1]] != 0);
      sz[T[rt][num ^ 1]]--;
      rt = T[rt][num ^ 1];
      ans += 1 << i;
    }
  }
  return ans;
}
void fmain(int ID) {
  scanf("%d", &n);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int x;
    scanf("%d", &x);
    add(x);
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    printf("%d ", fd(a[i]));
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
