#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline long long toll(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int size[31 * (300000 + 5)], l[31 * (300000 + 5)], r[31 * (300000 + 5)];
int maxNodes = 0;
vector<int> a, p;
void insert(int curNode, int val, int bit = 31) {
  size[curNode]++;
  if (bit == -1) return;
  if (val & (1 << bit)) {
    if (r[curNode] == -1) r[curNode] = ++maxNodes;
    insert(r[curNode], val, bit - 1);
  } else {
    if (l[curNode] == -1) l[curNode] = ++maxNodes;
    insert(l[curNode], val, bit - 1);
  }
}
int search(int curNode, int val, int curXor, int bit = 31) {
  size[curNode]--;
  if (bit == -1) return curXor;
  if (!(val & (1 << bit))) {
    if (l[curNode] != -1 && size[l[curNode]])
      return search(l[curNode], val, curXor, bit - 1);
    else
      return search(r[curNode], val, curXor | (1 << bit), bit - 1);
  } else {
    if (r[curNode] != -1 && size[r[curNode]])
      return search(r[curNode], val, curXor, bit - 1);
    else
      return search(l[curNode], val, curXor | (1 << bit), bit - 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  a.assign(n, 0);
  p.assign(n, 0);
  memset(l, -1, sizeof(l));
  memset(r, -1, sizeof(r));
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) insert(0, p[i]);
  for (int i = 0; i < n; i++) cout << search(0, a[i], 0) << " ";
  return 0;
}
