#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = 0; i < v.size(); i++) os << v[i] << " ";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (typename set<T>::iterator it = v.begin(); it != v.end(); it++)
    os << *it << " ";
}
const int mod = 1e9 + 7;
const int N = 5e6 + 5;
int ch[N][2];
int cnt, root;
int val[N];
int a[N], p[N];
int f[N];
int newnode() {
  cnt++;
  ch[cnt][0] = ch[cnt][1] = 0;
  return cnt;
}
int query(int x) {
  int u = root;
  int ret = 0;
  int i;
  for (i = 31; i >= 0; i--) {
    int b = (x >> i) & 1;
    if (!ch[u][b]) {
      ret += (1 << i);
      u = ch[u][!b];
    } else {
      u = ch[u][b];
    }
  }
  val[u]--;
  if (val[u] == 0) {
    int v = u;
    while (v != root && !val[v]) {
      int flag = 0;
      if (ch[f[v]][0] && ch[f[v]][1]) {
        flag = 1;
      }
      if (ch[f[v]][0] == v) {
        ch[f[v]][0] = 0;
      } else {
        ch[f[v]][1] = 0;
      }
      v = f[v];
      if (flag) break;
    }
  }
  return ret;
}
void insert(int x) {
  int u = root;
  for (int i = (31); i >= (0); i--) {
    int b = (x >> i) & 1;
    if (!ch[u][b]) {
      int v;
      ch[u][b] = v = newnode();
      f[v] = u;
      u = ch[u][b];
    } else {
      u = ch[u][b];
    }
  }
  val[u]++;
}
int main() {
  int n;
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> a[i];
  }
  for (int i = (1); i <= (n); i++) {
    cin >> p[i];
    insert(p[i]);
  }
  for (int i = (1); i <= (n); i++) {
    cout << query(a[i]) << " ";
  }
}
