#include <bits/stdc++.h>
using namespace std;
int cnt[5000005], p[5000006][2];
int m = 1;
void add(int x) {
  int l = x;
  int y = 0;
  int i;
  for (i = 29; i >= 0; i--) {
    int bit = ((x >> i) & 1);
    if (p[y][bit] == -1) {
      p[y][bit] = m;
      m++;
      y = p[y][bit];
    } else {
      y = p[y][bit];
    }
    cnt[y]++;
  }
}
int query(int x) {
  int i, y = 0, ans = 0;
  for (i = 29; i >= 0; i--) {
    int bit = ((x >> i) & 1);
    if (bit == 0 and p[y][bit] != -1 and cnt[p[y][bit]] > 0) {
      y = p[y][bit];
      cnt[y]--;
    } else if (bit == 0 and (p[y][bit] == -1 or cnt[p[y][bit]] == 0)) {
      ans += ((1 << i));
      y = p[y][1];
      cnt[y]--;
    } else if (bit == 1 and p[y][bit] != -1 and cnt[p[y][bit]] > 0) {
      y = p[y][bit];
      cnt[y]--;
    } else {
      ans += ((1 << (i)));
      y = p[y][0];
      cnt[y]--;
    }
  }
  return ans;
}
int a[300005], pi[300005];
int main() {
  int i, n;
  scanf("%d", &n);
  ;
  memset(p, -1, sizeof(p));
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ;
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &pi[i]);
    ;
    add(pi[i]);
  }
  for (i = 0; i < n; i++) {
    printf("%d", query(a[i]));
    ;
    printf(" ");
  }
}
