#include <bits/stdc++.h>
#pragma GCC optimize("O3")
std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                            {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
using namespace std;
int n, x, a[1 << 19];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  multiset<int> ms;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    ms.insert(x);
  }
  for (int i = 1; i <= n; i++) {
    auto it = ms.begin();
    auto itt = ms.end();
    itt--;
    int x = 0;
    for (int j = 29; j + 1; j--) {
      if (a[i] & (1LL << j)) {
        if (*itt >= x + (1LL << j)) {
          x += (1LL << j);
          auto luh = ms.lower_bound(x);
          if (*luh > *it) it = luh;
        }
      } else {
        if (*it < x + (1LL << j)) {
          auto luh = ms.lower_bound(x + (1LL << j));
          luh--;
          if (*luh < *itt) itt = luh;
        } else
          x += (1LL << j);
      }
    }
    cout << (a[i] ^ (*it)) << ' ';
    ms.erase(it);
  }
}
