#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long N = 2e5 + 10;
const long long mod = 1e9 + 7;
struct Trie {
  Trie *child[2];
  long long cnt;
};
Trie *createNode() {
  Trie *node = (Trie *)malloc(sizeof(Trie));
  memset(node->child, NULL, sizeof node->child);
  node->cnt = 0;
  return node;
}
void insert(Trie *root, long long x) {
  for (long long i = 30; i >= 0; --i) {
    long long val = (1LL << i);
    long long bit = 0;
    if (val & x) bit = 1;
    if (!root->child[bit]) root->child[bit] = createNode();
    root = root->child[bit];
    root->cnt++;
  }
}
void erase(Trie *root, long long x) {
  for (long long i = 30; i >= 0; --i) {
    long long val = (1LL << i);
    long long bit = 0;
    if (val & x) bit = 1;
    if (!root->child[bit]) root->child[bit] = createNode();
    root = root->child[bit];
    root->cnt--;
  }
}
long long query(Trie *root, long long x) {
  long long ans = 0;
  for (long long i = 30; i >= 0; --i) {
    long long val = (1 << i);
    long long bit = 0;
    if (val & x) bit = 1;
    if (root->child[bit] && root->child[bit]->cnt > 0) {
      root = root->child[bit];
    } else {
      assert(root->child[bit ^ 1] && root->child[bit ^ 1]->cnt > 0);
      ans += val;
      root = root->child[bit ^ 1];
    }
  }
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) cin >> b[i];
  Trie *root = createNode();
  for (long long i = 0; i < n; ++i) {
    insert(root, b[i]);
  }
  vector<long long> ans;
  for (long long i = 0; i < n; ++i) {
    long long x = query(root, a[i]);
    ans.push_back(x);
    erase(root, a[i] ^ x);
  }
  for (long long i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
}
