#include <bits/stdc++.h>
using namespace std;
long long n, a[300005], p[300005];
multiset<long long> ms;
multiset<long long>::iterator iter1, iter2;
long long powtwo[35];
long long sumpowtwo[35];
char bin[35];
void tobin(long long curr) {
  int i = 29;
  while (curr) {
    bin[i] = char((curr % 2) + '0');
    curr /= 2;
    i--;
  }
  while (i >= 0) bin[i--] = '0';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  powtwo[0] = sumpowtwo[0] = 1;
  for (int i = 1; i < 35; ++i) {
    powtwo[i] = powtwo[i - 1] * 2ll;
    sumpowtwo[i] = powtwo[i] + sumpowtwo[i - 1];
  }
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    ms.insert(x);
  }
  for (int i = 0; i < n; ++i) {
    tobin(a[i]);
    long long mn = 0, mx;
    int j = 0;
    while (1) {
      for (; j < 30; ++j) {
        if (bin[j] == '1') mn += powtwo[29 - j];
        mx = mn + sumpowtwo[28 - j];
        iter1 = ms.lower_bound(mn);
        iter2 = ms.upper_bound(mx);
        if (iter1 == iter2) break;
      }
      if (j == 30) {
        cout << (*iter1 xor a[i]) << ' ';
        ms.erase(iter1);
        break;
      } else {
        bin[j] = char(1 - (bin[j] - '0') + '0');
        if (bin[j] == '0') mn -= powtwo[29 - j];
      }
    }
  }
  return 0;
}
