#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A, K;
class Trie {
 public:
  Trie() {
    for (int i = 0; i < 2; i++) {
      cnt = 0;
      arr[i] = NULL;
    }
  }
  void insert(int val, int i = 29) {
    if (i == -1) return;
    int bit = (val & (1 << i)) == (1 << i);
    if (arr[bit] == NULL) {
      arr[bit] = new Trie();
    }
    arr[bit]->cnt++;
    arr[bit]->insert(val, i - 1);
  }
  void search(int val, int& rslt, int i = 29) {
    if (i == -1) return;
    int bit = (val & (1 << i)) == (1 << i);
    if (!arr[bit] || arr[bit]->cnt == 0) {
      rslt |= (1 << i);
      bit = !bit;
    }
    arr[bit]->cnt--;
    arr[bit]->search(val, rslt, i - 1);
  }

 private:
  Trie* arr[2];
  int cnt;
};
int main() {
  cin >> N;
  Trie obj;
  A.resize(N);
  K.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> K[i];
    obj.insert(K[i]);
  }
  for (int i = 0; i < N; i++) {
    int rslt = 0;
    obj.search(A[i], rslt);
    cout << rslt << " ";
  }
  return 0;
}
