#include <bits/stdc++.h>
using namespace std;
struct trie {
  trie* a[2];
  int cnt;
};
trie* root;
int n;
int a[300005];
trie* newnode() {
  trie* r = new (trie);
  for (int i = 0; i < 2; i++) (*r).a[i] = nullptr;
  (*r).cnt = 0;
  return r;
}
void inp() {
  root = newnode();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    trie* p = root;
    for (int j = 29; j >= 0; j--) {
      int id = (x >> j) & 1;
      if ((*p).a[id] == nullptr) (*p).a[id] = newnode();
      p = (*p).a[id];
      (*p).cnt++;
    }
  }
}
void proc() {
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = 0;
    trie* p = root;
    for (int j = 29; j >= 0; j--) {
      int id = (a[i] >> j) & 1;
      if ((*p).a[id] == nullptr) {
        p = (*p).a[1 - id];
        (*p).cnt--;
        ans += 1 << j;
      } else {
        trie* t = (*p).a[id];
        if ((*t).cnt == 0) {
          p = (*p).a[1 - id];
          (*p).cnt--;
          ans += 1 << j;
        } else {
          p = t;
          (*p).cnt--;
        }
      }
    }
    printf("%d ", ans);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  inp();
  proc();
  return 0;
}
