#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:336777216")
using namespace std;
const double pi = (double)3.141592653589793238462643383279502884197169399375105;
long long MOD = (long long)1e9 + 7;
long long power(long long n, long long k) {
  if (k == 0)
    return 1;
  else if (k == 1)
    return n;
  else {
    if (k % 2 == 0)
      return power((n * n), k / 2);
    else
      return (power((n * n), k / 2) * n);
  }
}
long long modInv(long long n) { return power(n, MOD - 2); }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long arr[(long long)3e5 + 3];
long long pow2[(long long)35];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  multiset<long long> tree;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    tree.insert(k);
  }
  pow2[0] = 1;
  for (int i = 1; i <= 30; i++) {
    pow2[i] = pow2[i - 1] * 2;
  }
  long long lowmin, lowmax, highmin, highmax;
  for (int i = 0; i < n; i++) {
    long long value = 0;
    for (long long k = 29; k >= 0; k--) {
      long long temp = value + pow2[k];
      lowmin = value;
      lowmax = temp - 1;
      highmin = temp;
      highmax = temp + pow2[k] - 1;
      auto it = tree.lower_bound(lowmin);
      auto jt = tree.lower_bound(highmin);
      if (it == tree.end() || *it > lowmax) {
        value = temp;
      } else if (jt == tree.end() || *jt > highmax) {
      } else {
        long long a, b;
        a = value ^ arr[i];
        b = temp ^ arr[i];
        if (a > b) {
          value = temp;
        } else {
        }
      }
    }
    cout << (arr[i] ^ value) << " ";
    tree.erase(tree.find(value));
  }
  return 0;
}
