#include <bits/stdc++.h>
const int MAX_POW = 536870912;
int A[300000];
struct node {
  int cnt;
  node *zero, *one;
  node() : cnt(0), zero(nullptr), one(nullptr) {}
};
void add(node *root, int number) {
  node *cur_node = root;
  cur_node->cnt += 1;
  for (int p = MAX_POW; p > 0; p /= 2) {
    if (number & p) {
      if (!cur_node->one) {
        cur_node->one = new node();
      }
      cur_node = cur_node->one;
      cur_node->cnt += 1;
    } else {
      if (!cur_node->zero) {
        cur_node->zero = new node();
      }
      cur_node = cur_node->zero;
      cur_node->cnt += 1;
    }
  }
}
bool has_zero(node *inode) {
  return inode->zero ? inode->zero->cnt > 0 : false;
}
bool has_one(node *inode) { return inode->one ? inode->one->cnt > 0 : false; }
int find_max_and_remove(node *root, int number) {
  node *cur_node = root;
  int max_number = 0;
  for (int p = MAX_POW; p > 0; p /= 2) {
    if (has_zero(cur_node) && (((number & p) == 0) || !has_one(cur_node))) {
      cur_node = cur_node->zero;
      cur_node->cnt -= 1;
    } else {
      cur_node = cur_node->one;
      cur_node->cnt -= 1;
      max_number |= p;
    }
  }
  return max_number;
}
int main() {
  int N;
  std::cin >> N;
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  node *root = new node();
  for (int i = 0; i < N; ++i) {
    int input_K;
    std::cin >> input_K;
    add(root, input_K);
  }
  for (int i = 0; i < N; ++i) {
    std::cout << (A[i] ^ find_max_and_remove(root, A[i])) << ' ';
  }
  std::cout << std::endl;
  return 0;
}
