#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 10;
long long A[maxn], B[maxn];
multiset<long long> M;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (long long i = 0; i < n; i++) {
    long long m;
    cin >> m;
    M.insert(m);
  }
  for (long long i = 0; i < n; i++) {
    long long pref = 0, newpref = 0;
    for (long long j = 29; j >= 0; j--) {
      if (!(A[i] & (1ll << j))) {
        long long x = *(M.lower_bound(pref));
        long long y = -10;
        if (M.lower_bound(pref + (1ll << j)) != M.end())
          y = *(M.lower_bound(pref + (1ll << j)));
        if (x == y) pref += 1ll << j;
      } else {
        newpref = pref + (1ll << j);
        auto x = M.lower_bound(newpref);
        if (x != M.end() && (*x >> j) == (newpref >> j)) pref += 1ll << j;
      }
    }
    B[i] = A[i] ^ pref;
    M.erase(M.find(pref));
  }
  for (long long i = 0; i < n; i++) cout << B[i] << ' ';
}
