#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  long long int k;
  node* n[2];
  node(void) {
    k = 0;
    for (long long int i = 0; i < 2; i++) n[i] = NULL;
  }
};
class trie {
 private:
  node* h;

 public:
  trie(void) { h = new node(); }
  void add(long long int number) {
    node* it = h;
    long long int tmp = 0;
    long long int tmp2 = number;
    for (long long int i = 0; i < 31; i++) {
      tmp = (tmp << 1) | (tmp2 & 1);
      tmp2 = (tmp2 >> 1);
    }
    for (long long int i = 0; i < 31; i++) {
      it->k++;
      if (it->n[tmp & 1] == NULL) it->n[tmp & 1] = new node();
      it = it->n[tmp & 1];
      tmp = (tmp >> 1);
    }
    it->k++;
  }
  long long int getAndRemove(long long int number) {
    node* it = h;
    long long int ans = 0;
    long long int tmp = 0;
    long long int tmp2 = number;
    for (long long int i = 0; i < 31; i++) {
      tmp = (tmp << 1) | (tmp2 & 1);
      tmp2 = (tmp2 >> 1);
    }
    for (long long int i = 0; i < 31; i++) {
      it->k--;
      long long int next = tmp & 1;
      if ((it->n[tmp & 1] == NULL) || (it->n[tmp & 1]->k == 0))
        next = !(tmp & 1);
      it = it->n[next];
      tmp = (tmp >> 1);
      ans = (ans << 1) | (next);
    }
    it->k--;
    return ans;
  }
};
int main() {
  ios::sync_with_stdio(0);
  long long int N;
  cin >> N;
  long long int* A = new long long int[N];
  long long int* P = new long long int[N];
  for (long long int i = 0; i < N; i++) cin >> A[i];
  for (long long int i = 0; i < N; i++) cin >> P[i];
  trie T;
  for (long long int i = 0; i < N; i++) T.add(P[i]);
  for (long long int i = 0; i < N; i++) {
    long long int tmp = T.getAndRemove(A[i]);
    cout << (tmp ^ A[i]) << ' ';
  }
  return 0;
}
