#include <bits/stdc++.h>
using namespace std;
struct vertex {
  long long int nxt[2], cnt;
  bool leaf = false;
  vertex() {
    nxt[0] = nxt[1] = (-1);
    cnt = 0;
  }
};
vector<vertex> t(1);
long long int a[300005];
void add(vector<long long int> g) {
  long long int v = 0;
  for (long long int i = 0; i < g.size(); i++) {
    if (t[v].nxt[g[i]] == (-1)) {
      t[v].nxt[g[i]] = t.size();
      t.emplace_back();
    }
    v = t[v].nxt[g[i]];
    t[v].cnt++;
  }
  t[v].leaf = true;
}
long long int dfs(vector<long long int> g) {
  long long int v = 0, res = 0, c = 30;
  for (long long int i = 0; i < g.size(); i++) {
    long long int a = t[v].nxt[g[i]], b = t[v].nxt[g[i] ^ 1];
    if (a == (-1) || t[a].cnt == 0) {
      res += pow(2, c);
      a = b;
    }
    t[a].cnt--;
    v = a;
    c--;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  for (long long int i = 1; i <= n; i++) {
    long long int x, cnt = 30;
    cin >> x;
    vector<long long int> g(31, 0);
    while (x > 0) {
      if (x & 1) g[cnt] = 1;
      x >>= 1;
      cnt--;
    }
    add(g);
  }
  for (long long int i = 1; i <= n; i++) {
    vector<long long int> g(31, 0);
    long long int cnt = 30;
    while (a[i] > 0) {
      if (a[i] & 1) g[cnt] = 1;
      a[i] >>= 1;
      cnt--;
    }
    cout << dfs(g) << " ";
  }
}
