#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
struct node {
  int num;
  node *tire[2];
} * oo;
void init(node *x) {
  x->tire[0] = nullptr;
  x->tire[1] = nullptr;
  x->num = 0;
}
int a[maxn], p[maxn], ans[maxn], s[30];
void change(int x) {
  int e = 0;
  while (x) {
    s[e++] = x & 1;
    x >>= 1;
  }
  reverse(s, s + 30);
}
void Add(int x) {
  node *head = oo;
  memset(s, 0, sizeof(s));
  change(x);
  for (int i = 0; i < 30; ++i) {
    int k = s[i];
    if (head->tire[k] == nullptr) {
      head->tire[k] = new node;
      head = head->tire[k];
      init(head);
      head->num++;
    } else {
      head = head->tire[k];
      head->num++;
    }
  }
}
int cal(int x) {
  node *head = oo;
  int res = 0;
  int k = 536870912;
  memset(s, 0, sizeof(s));
  change(x);
  for (int i = 0; i < 30; i++) {
    int pos = s[i];
    if (head->tire[pos] == nullptr) {
      head = head->tire[!pos];
      head->num--;
      res += k;
    } else {
      node *p = head->tire[pos];
      if (p->num == 0) {
        head = head->tire[!pos];
        head->num--;
        res += k;
      } else {
        head = p;
        head->num--;
      }
    }
    k >>= 1;
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  oo = new node;
  init(oo);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
    Add(p[i]);
  }
  for (int i = 0; i < n; i++) {
    ans[i] = cal(a[i]);
  }
  printf("%d", ans[0]);
  for (int i = 1; i < n; i++) {
    printf(" %d", ans[i]);
  }
  printf("\n");
  return 0;
}
