#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10034217728")
using namespace std;
struct Node {
  int next[2];
  bool leaf;
  int cnt;
  Node() {
    next[0] = next[1] = -1;
    leaf = 0;
    cnt = 0;
  }
};
vector<Node> trie;
void init_trie() { trie.push_back(Node()); }
void add_node(int t) {
  int cur = 0;
  for (int i = 30; i >= 0; i--) {
    int c = ((t >> i) & 1);
    if (trie[cur].next[c] == -1) {
      trie[cur].next[c] = trie.size();
      trie.push_back(Node());
    }
    cur = trie[cur].next[c];
    trie[cur].cnt++;
  }
  trie[cur].leaf = 1;
}
void del_node(int t) {
  int cur = 0;
  for (int i = 30; i >= 0; i--) {
    int c = ((t >> i) & 1);
    cur = trie[cur].next[c];
    trie[cur].cnt--;
  }
  if (trie[cur].cnt == 0) trie[cur].leaf = 0;
}
vector<int> ans;
void find_best(int t) {
  int cur = 0;
  int res_num = 0;
  for (int i = 30; i >= 0; i--) {
    int c = ((t >> i) & 1);
    int start_c = c;
    int to = trie[cur].next[c];
    if (to == -1 || trie[to].cnt < 1) c ^= 1;
    cur = trie[cur].next[c];
    res_num |= (1 << i) * (c ^ start_c);
    trie[cur].cnt--;
  }
  ans.push_back(res_num);
  if (trie[cur].cnt == 0) trie[cur].leaf = 0;
}
int main() {
  init_trie();
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    add_node(p[i]);
  }
  for (auto el : a) find_best(el);
  for (auto el : ans) cout << el << " ";
  return 0;
}
