#include <bits/stdc++.h>
struct Trie {
  const static long long ALPHA = 2;
  struct TrieNode {
    long long count;
    char value;
    long long all_count;
    std::vector<TrieNode*> next;
    TrieNode* parent;
    TrieNode(const char& val, TrieNode* p = nullptr) {
      value = val;
      count = 0;
      next.assign(ALPHA, nullptr);
      parent = p;
      all_count = 0;
    }
    ~TrieNode(void) {
      for (auto& e : next)
        if (e != nullptr) delete e;
    }
    long long count_all(void) { return all_count; }
  };
  TrieNode* root;
  Trie(void) { root = new TrieNode('$', nullptr); }
  ~Trie(void) { delete root; }
  void insert(const std::string& s) {
    TrieNode* curr = this->root;
    for (long long i = 0; i < s.length(); ++i) {
      long long tmp = std::tolower(s[i]) - 'a';
      if (curr->next[tmp] == nullptr)
        curr->next[tmp] = new TrieNode(tmp + 'a', curr);
      curr = curr->next[tmp];
    }
    curr->count++;
    for (; curr != nullptr; curr = curr->parent) curr->all_count++;
  }
  bool find(const std::string& s) const {
    TrieNode* curr = this->root;
    for (long long i = 0; i < s.length(); ++i) {
      long long tmp = std::tolower(s[i]) - 'a';
      if (curr->next[tmp] == nullptr) return false;
      curr = curr->next[tmp];
    }
    return curr->count > 0;
  }
  long long count_all(void) const { return this->root->count_all(); }
};
int main(void) {
  long long n;
  std::scanf("%lld", &n);
  std::vector<long long> A(n), P(n);
  for (auto& e : A) std::scanf("%lld", &e);
  Trie tr;
  for (auto& e : P) {
    std::scanf("%lld", &e);
    auto s = std::bitset<32>(e).to_string();
    std::transform(s.begin(), s.end(), s.begin(),
                   [](const char& c) { return c - '0' + 'a'; });
    tr.insert(s);
  }
  for (const auto& e : A) {
    auto s = std::bitset<32>(e).to_string();
    std::transform(s.begin(), s.end(), s.begin(),
                   [](const char& c) { return c - '0' + 'a'; });
    auto curr = tr.root;
    long long ret = 0;
    for (long long i = 0; i < s.length(); ++i, ret <<= 1) {
      if (curr->next[s[i] - 'a'] != nullptr &&
          curr->next[s[i] - 'a']->all_count > 0) {
        curr = curr->next[s[i] - 'a'];
      } else {
        curr = curr->next[1 - (s[i] - 'a')];
        ret |= 1;
      }
      curr->all_count--;
    }
    ret >>= 1;
    std::cout << ret << " ";
  }
  std::cout << "\n";
  return 0;
}
