#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long inf = 0xc0c0c0c0c0c0c0c0;
const double pi = acos(-1);
const int MAXN = 3e5 + 7;
const int MAXA = 2;
const int MAX = MAXN * 30;
int tree[MAX][MAXA];
int C[MAX];
int root, cnt;
int m[MAXN];
int N;
int query(int str) {
  int x = root;
  int ans = 0;
  for (int i = 29; ~i; i--) {
    int alp = (str >> i) & 1;
    if (tree[x][alp] == 0 || C[tree[x][alp]] == 0) {
      ans |= 1 << i;
      alp ^= 1;
    }
    x = tree[x][alp];
    C[x]--;
  }
  return ans;
}
void add(int str) {
  int x = root;
  for (int i = 29; ~i; i--) {
    int alp = (str >> i) & 1;
    if (tree[x][alp] == 0) tree[x][alp] = ++cnt;
    x = tree[x][alp];
    C[x]++;
  }
}
int main() {
  root = 1;
  cnt = 1;
  scanf("%d", &N);
  int i;
  for (i = 0; i < N; i++) scanf("%d", m + i);
  for (i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    add(x);
  }
  for (i = 0; i < N; i++) {
    printf("%d ", query(m[i]));
  }
  return 0;
}
