#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 100;
const int N = 6e5 + 10;
const long long mod = 1e9 + 7;
const int base = 131;
const double pi = acos(-1);
const double eps = 1e-8;
unordered_map<long long, long long> mp;
long long t, n, x, ans, m, k, y;
long long vis[N], a[N];
int tol;
long long val[20 * N];
int ch[20 * N][2];
int num[20 * N];
void init() {
  tol = 1;
  ch[0][0] = ch[0][1] = 0;
}
void ins(long long x) {
  int u = 0;
  for (int i = 32; i >= 0; i--) {
    int v = (x >> i) & 1;
    if (!ch[u][v]) {
      ch[tol][0] = ch[tol][1] = 0;
      val[tol] = 0;
      ch[u][v] = tol++;
    }
    u = ch[u][v];
    num[u]++;
  }
  val[u] = x;
}
void update(long long x, int c) {
  int u = 0;
  for (int i = 32; i >= 0; i--) {
    int v = (x >> i) & 1;
    u = ch[u][v];
    num[u] += c;
  }
}
long long query(long long x) {
  int u = 0;
  for (int i = 32; i >= 0; i--) {
    int v = ((x >> i) & 1);
    if (ch[u][v] && num[ch[u][v]])
      u = ch[u][v];
    else
      u = ch[u][v ^ 1];
  }
  return val[u];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  init();
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> x, ins(x);
  for (int i = 1; i <= n; i++) {
    x = query(a[i]);
    cout << (a[i] ^ x) << " ";
    update(x, -1);
  }
}
