#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int MAXN_FOR_TRIE = 31 * 300 * 1000 + 228;
const int N = 300 * 1000 + 228;
struct Node {
  int nxt[2];
  int cnt;
  Node() {
    nxt[0] = nxt[1] = -1;
    cnt = 0;
  }
};
Node t[MAXN_FOR_TRIE];
int counter = 0;
inline void add(vector<int> v) {
  int n = (int)v.size();
  int now = 0;
  for (int i = 0; i < n; ++i) {
    if (t[now].nxt[v[i]] == -1) {
      t[now].nxt[v[i]] = ++counter;
    }
    now = t[now].nxt[v[i]];
    ++t[now].cnt;
  }
}
inline void del(vector<int> v) {
  int n = (int)v.size();
  int now = 0;
  for (int i = 0; i < n; ++i) {
    now = t[now].nxt[v[i]];
    --t[now].cnt;
  }
}
inline vector<int> get(vector<int> v) {
  int n = (int)v.size();
  int now = 0;
  vector<int> res;
  for (int i = 0; i < n; ++i) {
    int c = v[i];
    if (t[now].nxt[c] != -1 && t[t[now].nxt[c]].cnt > 0) {
      now = t[now].nxt[c];
      res.push_back(c);
    } else {
      now = t[now].nxt[c ^ 1];
      res.push_back(c ^ 1);
    }
  }
  return res;
}
inline vector<int> get_vector(int x) {
  vector<int> v;
  for (int i = 0; i < 30; ++i) {
    v.push_back((x >> i) & 1);
  }
  reverse(v.begin(), v.end());
  return v;
}
inline int get_int(vector<int> v) {
  int x = 0;
  for (int i = 0; i < 30; ++i) {
    if (v[i]) {
      x += (1 << (29 - i));
    }
  }
  return x;
}
int a[N], p[N], o[N];
signed main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
    add(get_vector(p[i]));
  }
  for (int i = 1; i <= n; ++i) {
    vector<int> kek = get(get_vector(a[i]));
    del(kek);
    o[i] = get_int(kek) ^ a[i];
  }
  for (int i = 1; i <= n; ++i) {
    cout << o[i] << " ";
  }
  cout << "\n";
  return 0;
}
