#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a;
}
int sub(int a, int b) {
  if ((a -= b) < 0) a += P;
  return a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = (3e5 + 7) * 33;
int n, a[N], x;
struct Trie {
  static const int N = ::N;
  int son[N][2], _, ch, siz[N];
  int ne() {
    fill_n(son[_], 2, -1);
    return _++;
  }
  void ini() {
    _ = 0;
    ne();
  }
  void insert(const int &s) {
    int u = 0;
    siz[u]++;
    for (int i = (31) - 1; i >= (0); i--) {
      ch = ((1ll << (i)) & s) > 0;
      int &v = son[u][ch];
      if (!~v) v = ne();
      u = v;
      siz[u]++;
    }
  }
  int find(const int &s) {
    int u = 0;
    siz[u]--;
    int res = 0;
    for (int i = (31) - 1; i >= (0); i--) {
      ch = ((1ll << (i)) & s) > 0;
      if (son[u][ch] != -1 && siz[son[u][ch]] > 0) {
        u = son[u][ch];
        if (ch) res |= (1ll << (i));
      } else {
        u = son[u][ch ^ 1];
        if (ch ^ 1) res |= (1ll << (i));
      }
      siz[u]--;
    }
    return res ^ s;
  }
} tree;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n;
  tree.ini();
  for (int i = (1); i < (n + 1); i++) cin >> a[i];
  for (int i = (1); i < (n + 1); i++) cin >> x, tree.insert(x);
  for (int i = (1); i < (n + 1); i++) cout << tree.find(a[i]) << " ";
  return 0;
}
