#include <bits/stdc++.h>
int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
using namespace std;
long long power(long long a, long long p, long long M) {
  long long r = 1;
  a = a % M;
  while (p > 0) {
    if (p % 2) r = (r * a) % M;
    a = (a * a) % M;
    p /= 2;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
struct node {
  int c;
  struct node *child[2];
  node() {
    child[0] = child[1] = NULL;
    c = 0;
  }
};
long long n;
long long a[(int)3e5 + 5], p[(int)3e5 + 5];
struct node *trie;
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) scanf("%lld", &a[i]);
  ;
  for (long long i = 0; i < n; i++) scanf("%lld", &p[i]);
  ;
  trie = new node();
  struct node *cur = trie;
  for (long long i = 0; i < n; i++) {
    cur = trie;
    long long x = p[i];
    for (int j = 30; j >= 0; j--) {
      int bit = (1LL << j) & x;
      if (bit) bit = 1;
      if (cur->child[bit] == NULL) cur->child[bit] = new node();
      cur = cur->child[bit];
      (cur)->c++;
    }
  }
  cur = trie;
  for (long long i = 0; i < n; i++) {
    cur = trie;
    long long x = a[i];
    long long y = 0;
    for (int j = 30; j >= 0; j--) {
      int bit = (1LL << j) & x;
      if (bit) bit = 1;
      if (cur->child[bit] && (cur->child[bit])->c > 0) {
        (cur->child[bit])->c--;
        cur = cur->child[bit];
      } else {
        (cur->child[!bit])->c--;
        y += (1LL << j);
        cur = cur->child[!bit];
      }
    }
    cout << y << " ";
  }
  cout << endl;
}
int main() {
  solve();
  return 0;
}
