#include <bits/stdc++.h>
using namespace std;
int n;
int a[300100];
int p[300100];
string s;
struct node {
  node* child[2];
  int cnt;
  node() {
    child[0] = child[1] = NULL;
    cnt = 0;
  }
} * root;
void add() {
  node* tmp = root;
  for (int i = 0, sz = s.size(); i < sz; ++i) {
    if (tmp->child[s[i] - '0'] == NULL) tmp->child[s[i] - '0'] = new node();
    tmp = tmp->child[s[i] - '0'];
    ++(tmp->cnt);
  }
}
string s_del;
void del(node* tmp, int idx) {
  if (idx == s_del.size() + 1) return;
  --(tmp->cnt);
  if (s_del.size() == idx) return;
  del(tmp->child[s_del[idx] - '0'], idx + 1);
  if (tmp->child[s_del[idx] - '0']->cnt)
    ;
  else {
    delete tmp->child[s_del[idx] - '0'];
    tmp->child[s_del[idx] - '0'] = NULL;
  }
}
void qu(node* tmp, int idx) {
  if (idx == s.size()) return;
  if (s[idx] == '1') {
    if (tmp->child[1] == NULL) {
      s_del += '0';
      qu(tmp->child[0], idx + 1);
    } else {
      s_del += '1';
      qu(tmp->child[1], idx + 1);
    }
  } else {
    if (tmp->child[0] == NULL) {
      s_del += '1';
      qu(tmp->child[1], idx + 1);
    } else {
      s_del += '0';
      qu(tmp->child[0], idx + 1);
    }
  }
}
int main() {
  root = new node();
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
    s = "";
    while (p[i]) s += (p[i] & 1 ? '1' : '0'), p[i] /= 2;
    while (s.size() < 31) s += '0';
    reverse(s.begin(), s.end());
    add();
  }
  long long tmp;
  for (int i = 0; i < n; ++i) {
    tmp = 0;
    s = "";
    s_del = "";
    while (a[i]) s += (a[i] & 1 ? '1' : '0'), a[i] /= 2;
    while (s.size() < 31) s += '0';
    reverse(s.begin(), s.end());
    qu(root, 0);
    for (int j = 0; j < s_del.size(); ++j)
      tmp += (s_del[j] == s[j] ? 0 : (1ll << (s_del.size() - j - 1)));
    del(root, 0);
    printf("%lld ", tmp);
  }
  return 0;
}
