#include <bits/stdc++.h>
using namespace std;
const int N = 3e5;
int n;
struct Node {
  int go[2];
  int sz[2];
  Node() { sz[0] = sz[1] = 0; }
};
int a[N];
int p[N];
int ans[N];
vector<Node> v;
int t = 0;
void add(int x, int lvl = 29, int cur = 0) {
  if (lvl == -1) return;
  int y = ((x & (1 << lvl)) != 0);
  if (v[cur].sz[y] == 0) {
    v[cur].go[y] = v.size();
    v.push_back(Node());
  }
  v[cur].sz[y]++;
  if (y) x ^= (1 << lvl);
  add(x, lvl - 1, v[cur].go[y]);
}
void del(int x, int lvl = 29, int cur = 0) {
  if (lvl == -1) return;
  int y = ((x & (1 << lvl)) != 0);
  if (y) x ^= (1 << lvl);
  if (v[cur].sz[y] != 0) {
    v[cur].sz[y]--;
    del(x, lvl - 1, v[cur].go[y]);
  } else {
    ans[t] += (1 << lvl);
    y ^= 1;
    v[cur].sz[y]--;
    del(x, lvl - 1, v[cur].go[y]);
  }
}
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> p[i];
  v.push_back(Node());
  for (int i = 0; i < n; i++) add(p[i]);
  for (int i = 0; i < n; i++) {
    del(a[i]);
    t++;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
