#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 50;
const int oo = 1e9;
const int mod = 1e9 + 7;
struct node {
  int nxt[2], f, num;
  node() {
    nxt[0] = nxt[1] = -1;
    f = 0;
    num = 0;
  }
};
vector<node> v;
int a[N];
void insert(int x) {
  int cur = 0;
  for (int i = 30; i >= 0; i--) {
    int d = ((x >> i) & 1);
    if (v[cur].nxt[d] == -1) {
      v[cur].nxt[d] = v.size();
      v.push_back(node());
    }
    cur = v[cur].nxt[d];
    v[cur].f++;
  }
  v[cur].num = x;
}
int get(int x) {
  int cur = 0;
  for (int i = 30; i >= 0; i--) {
    if ((x >> i) & 1) {
      int go = v[cur].nxt[1];
      if (go == -1 || !v[go].f)
        cur = v[cur].nxt[0];
      else
        cur = go;
    } else {
      int go = v[cur].nxt[0];
      if (go == -1 || !v[go].f)
        cur = v[cur].nxt[1];
      else
        cur = go;
    }
    v[cur].f--;
  }
  return v[cur].num;
}
int main() {
  v.push_back(node());
  int n, k;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) {
    scanf("%d", &k);
    insert(k);
  }
  for (int i = 0; i < n; i++) printf("%d ", get(a[i]) ^ a[i]);
  puts("");
}
