#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 42;
const int MAXLOG = 30;
struct Trie {
  int size;
  Trie* left;
  Trie* right;
  Trie() : size(0), left(NULL), right(NULL) {}
};
typedef Trie* trie;
inline void add(trie node, int v) {
  for (int i = 29; i >= 0; --i) {
    ++node->size;
    if (v & (1 << i)) {
      if (!node->left) {
        node->left = new Trie();
      }
      node = node->left;
    } else {
      if (!node->right) {
        node->right = new Trie();
      }
      node = node->right;
    }
  }
  ++node->size;
}
inline void del(trie node, int v) {
  for (int i = 29; i >= 0; --i) {
    --node->size;
    if (v & (1 << i)) {
      node = node->left;
    } else {
      node = node->right;
    }
  }
  --node->size;
}
inline bool is(trie a) {
  if (!a) return 0;
  return a->size;
}
inline int gs(trie a) {
  if (!a) return 0;
  return a->size;
}
vector<pair<int, int> > mem;
int n;
inline void rec(trie A, trie B, int lev, int cur_xor) {
  if (lev == -1) {
    --A->size;
    --B->size;
    mem.push_back(make_pair(cur_xor, 0));
    return;
  }
  assert(A->size == gs(A->left) + gs(A->right));
  assert(B->size == gs(B->left) + gs(B->right));
  if ((is(A->left) && is(B->left)) || (is(A->right) && is(B->right))) {
    if ((is(A->left) && is(B->left))) {
      --A->size;
      --B->size;
      rec(A->left, B->left, lev - 1, cur_xor);
    }
    if ((is(A->right) && is(B->right))) {
      --A->size;
      --B->size;
      rec(A->right, B->right, lev - 1, cur_xor);
    }
  } else {
    if (is(A->left) && is(B->right)) {
      --A->size;
      --B->size;
      rec(A->left, B->right, lev - 1, cur_xor ^ (1 << lev));
    }
    if (is(A->right) && is(B->left)) {
      --A->size;
      --B->size;
      rec(A->right, B->left, lev - 1, cur_xor ^ (1 << lev));
    }
  }
}
inline void best_match(int a, trie B) {
  int ans = 0;
  for (int i = 29; i >= 0; --i) {
    --B->size;
    if (!(a & (1 << i))) {
      if (is(B->right)) {
        B = B->right;
      } else {
        B = B->left;
        ans += (1 << i);
      }
    } else {
      if (is(B->left)) {
        B = B->left;
      } else {
        B = B->right;
        ans += (1 << i);
      }
    }
  }
  --B->size;
  printf("%d ", ans);
}
int a[MAXN];
int b[MAXN];
int main() {
  scanf("%d", &n);
  trie A = new Trie();
  trie B = new Trie();
  int p;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p);
    add(B, p);
  }
  for (int i = 0; i < n; ++i) {
    best_match(a[i], B);
  }
}
