#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
struct FAIL {
  FAIL() {
    cout << "CHANGE!!!"
         << "\n";
  }
};
template <class T>
class FenwickTree {
  int maxn = 1000000;
  vector<T> t;
  T sum(int r) {
    int result = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) {
      result += t[r];
    }
    return result;
  }

 public:
  void init(const vector<T>& a) {
    init((int)a.size());
    for (unsigned i = 0; i < a.size(); ++i) {
      inc(i, a[i]);
    }
  }
  void init(int n) {
    maxn = n;
    t.assign(n, 0);
  }

 public:
  FenwickTree(int n) {
    maxn = n;
    t.resize(maxn);
  }
  T sum(int l, int r) { return sum(r) - sum(l - 1); }
  void update(int i, int delta) {
    for (; i < maxn; i = (i | (i + 1))) {
      t[i] += delta;
    }
  }
  FenwickTree() {}
};
class SSet {
 public:
  SSet(const vector<int>& v) {
    vector<int> un = v;
    sort(un.begin(), un.end());
    un.resize(unique(un.begin(), un.end()) - un.begin());
    tree.init(un.size());
    for (int i = (0); i < (v.size()); ++i) {
      int pos = ::lower_bound(un.begin(), un.end(), v[i]) - un.begin();
      tree.update(pos, 1);
    }
    a = un;
  }
  int lower_bound(int x) {
    int pos = ::lower_bound(a.begin(), a.end(), x) - a.begin() - 1;
    if (pos < 0) {
      return 0;
    }
    return tree.sum(0, pos);
  }
  void erase(int x) {
    int pos = ::lower_bound(a.begin(), a.end(), x) - a.begin();
    tree.update(pos, -1);
  }

 private:
  FenwickTree<int> tree;
  vector<int> a;
};
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> a(n);
  for (int __i = 0; __i < (n); ++__i) cin >> v[__i];
  ;
  for (int __i = 0; __i < (n); ++__i) cin >> a[__i];
  ;
  SSet s(a);
  for (int i = (0); i < (n); ++i) {
    int x = v[i];
    int cur = 0;
    int shift = 0;
    for (int j = (29); j > (-1); --j) {
      shift = (1 << j);
      if (x & shift) {
        if (s.lower_bound(cur + 2 * shift) - s.lower_bound(cur + 1 * shift) ==
            0) {
          cur |= 0;
        } else {
          cur |= shift;
        }
      } else {
        if (s.lower_bound(cur + 1 * shift) - s.lower_bound(cur + 0 * shift) ==
            0) {
          cur |= shift;
        } else {
          cur |= 0;
        }
      }
    }
    s.erase(cur);
    cout << (x ^ cur) << " ";
  }
}
