#include <bits/stdc++.h>
using namespace std;
class Trie_Tree {
 private:
  struct node {
    char val;
    map<char, node *> childs_mp;
    long long int deg;
    node *parent;
    int cnt;
  };
  bool erase_leaf(node *nodeptr) {
    if (nodeptr->val != '\0') {
      do {
        char v = nodeptr->val;
        nodeptr->cnt--;
        nodeptr = nodeptr->parent;
        if (nodeptr->childs_mp[v]->cnt == 0) {
          delete (nodeptr->childs_mp[v]);
          nodeptr->childs_mp.erase(v);
        }
      } while (nodeptr != root);
      nodeptr->cnt--;
      return true;
    } else
      return false;
  }
  node *root;
  bool multi_flag;

 public:
  Trie_Tree(vector<string> s, bool multi_flag) {
    root = new node{'\0', {}, 0, nullptr, 0};
    for (int i = 0; i < (int)s.size(); i++) add_str(s[i]);
    Trie_Tree::multi_flag = multi_flag;
  }
  void add_str(string s) {
    node *focus = root;
    for (int i = 0; i < (int)s.length(); i++) {
      char c = s[i];
      if (focus->childs_mp.find(c) == focus->childs_mp.end()) {
        node *node_buf = new node{c, {}, focus->deg + 1, focus, 0};
        focus->childs_mp[c] = node_buf;
      }
      focus->cnt++;
      focus = focus->childs_mp[c];
    }
    if (focus->childs_mp.find('\0') == focus->childs_mp.end()) {
      node *nil = new node{'\0', {}, focus->deg + 1, focus, 0};
      focus->childs_mp['\0'] = nil;
    }
    focus->cnt++;
    focus = focus->childs_mp['\0'];
    focus->cnt++;
    if (!multi_flag && focus->cnt >= 2) erase_leaf(focus);
  }
  bool find_str(string s) {
    node *focus = root;
    for (int i = 0; i < (int)s.length(); i++) {
      char c = s[i];
      if (focus->childs_mp.find(c) == focus->childs_mp.end())
        return false;
      else
        focus = focus->childs_mp[c];
    }
    if (focus->childs_mp.find('\0') != focus->childs_mp.end())
      return true;
    else
      return false;
  }
  bool erase_str(string s) {
    node *focus = root;
    for (int i = 0; i < (int)s.length(); i++) {
      char c = s[i];
      if (focus->childs_mp.find(c) == focus->childs_mp.end())
        return false;
      else
        focus = focus->childs_mp[c];
    }
    if (focus->childs_mp.find('\0') != focus->childs_mp.end()) {
      if (erase_leaf(focus))
        return true;
      else
        return false;
    } else
      return false;
  }
  void solve(vector<string> &s) {
    vector<int> ans(s.size());
    for (int i = 0; i < (int)s.size(); i++) {
      node *focus = root;
      int buf = 0;
      for (int j = 0; j < (int)32; j++) {
        if (focus->childs_mp.find(s[i][j]) != focus->childs_mp.end()) {
          focus = focus->childs_mp[s[i][j]];
        } else {
          focus = focus->childs_mp.begin()->second;
          buf += (1 << (31 - j));
        }
      }
      ans[i] = buf;
      erase_leaf(focus);
    }
    for (int i = 0; i < (int)ans.size(); i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
};
string convert(int x) {
  string ret;
  for (int i = 0; i < (int)32; i++) {
    ret += '0' + (x % 2);
    x /= 2;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  int n;
  cin >> n;
  vector<string> s(n), t(n);
  for (int i = 0; i < (int)n; i++) {
    int x;
    cin >> x;
    s[i] = convert(x);
  }
  for (int i = 0; i < (int)n; i++) {
    int x;
    cin >> x;
    t[i] = convert(x);
  }
  Trie_Tree trie(t, true);
  trie.solve(s);
}
