#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 123, N = 1e4 + 12, inf = 1e9, mod = 1e9 + 7,
                INF = 1e18, block = 1000;
const long double eps = 1e-12, PI = 3.141592653589793238462643383279;
long long n, a[maxn], ans[maxn];
set<long long> st;
map<long long, long long> cnt;
int gcnt(long long l, long long r) {
  if (st.lower_bound(l) == st.lower_bound(r + 1)) return 0;
  return 1;
}
int main() {
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%I64d", &x);
    cnt[x]++;
    st.insert(x);
  }
  st.insert(1e18);
  for (int i = 1; i <= n; i++) {
    long long L = 0, R = (1ll << 32) - 1, j = 32, val = a[i];
    while (L != R) {
      j--;
      long long M = (L + R) / 2;
      int a = gcnt(L, M);
      int b = gcnt(M + 1, R);
      if (a == 0) {
        L = M + 1;
        continue;
      }
      if (b == 0) {
        R = M;
        continue;
      }
      if ((val & (1ll << j)) != 0)
        L = M + 1;
      else
        R = M;
    }
    ans[i] = a[i] ^ L;
    cnt[L]--;
    if (cnt[L] == 0) st.erase(L);
  }
  for (int i = 1; i <= n; i++) printf("%I64d ", ans[i]);
}
