#include <bits/stdc++.h>
using namespace std;
struct vertex {
  vertex* next[2];
  int kol = 0;
};
int a[300500];
int b[300500];
vertex* tr;
int main() {
  tr = new vertex();
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", b + i);
    auto t = tr;
    tr->kol++;
    for (int j = 29; j >= 0; j--) {
      int u = !!((1 << j) & b[i]);
      if (0 == t->next[u]) {
        t->next[u] = new vertex();
      }
      t = t->next[u];
      t->kol++;
    }
  }
  for (int i = 0; i < n; i++) {
    auto t = tr;
    int res = 0;
    for (int j = 29; j >= 0; j--) {
      int u = !!((1 << j) & a[i]);
      if (t->next[u] && t->next[u]->kol) {
        t = t->next[u];
        t->kol--;
      } else {
        res += (1 << j);
        t = t->next[1 - u];
        t->kol--;
      }
    }
    cout << res << ' ';
  }
  return 0;
}
