#include <bits/stdc++.h>
using namespace std;
struct node {
  int num, sum;
  node* Next[2];
};
node* create() {
  node* t = new node();
  t->sum = 0;
  t->Next[0] = t->Next[1] = NULL;
  return t;
}
void Add(node* head, int x) {
  node* p = head;
  for (int i = 29; i >= 0; i--) {
    int k = (x >> i) & 1;
    if (p->Next[k] == NULL) p->Next[k] = create();
    p = p->Next[k];
    p->sum++;
  }
  p->num = x;
}
int Find(node* head, int x) {
  node* p = head;
  int ans = 0;
  for (int i = 29; i >= 0; i--) {
    int k = (x >> i) & 1;
    if (p->Next[k] != NULL && p->Next[k]->sum > 0)
      p = p->Next[k];
    else
      p = p->Next[k ^ 1], ans += (1 << i);
    p->sum--;
  }
  return ans;
}
int main() {
  int n, a[300005];
  node* head = create();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    Add(head, x);
  }
  for (int i = 1; i <= n; i++)
    printf("%d%c", Find(head, a[i]), i == n ? '\n' : ' ');
  return 0;
}
