#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };
template <typename T>
ostream &operator<<(ostream &cout, vector<T> &a) {
  for (size_t i = 0; i < a.size(); ++i) cout << a[i] << " ";
  return cout;
}
template <typename T>
ostream &operator<<(ostream &cout, vector<vector<T> > &a) {
  for (size_t i = 0; i < a.size(); ++i) cout << a[i] << endl;
  return cout;
}
unsigned a[300000];
multiset<unsigned> s;
bool cnt(unsigned a, unsigned b) {
  return s.lower_bound(a) != s.lower_bound(b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    unsigned x;
    cin >> x;
    s.insert(x);
  }
  for (int i = 0; i < n; ++i) {
    unsigned x = a[i];
    unsigned cur = 0;
    for (int j = 29; j >= 0; --j) {
      const unsigned g = 1U << j;
      if (x & g) {
        if (cnt(cur | g, (cur | g) + g)) {
          cur |= g;
        }
      } else {
        if (!cnt(cur, cur | g)) {
          cur |= g;
        }
      }
    }
    cout << (x ^ cur) << " ";
    s.erase(s.find(cur));
  }
  return 0;
}
