#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 4e6;
struct trie {
  int p;
  vector<vector<int>> t;
  vector<int> fim, pref;
  trie() : t(MAX, vector<int>(2)), fim(MAX), pref(MAX) { p = 1; }
  void insert(string second) {
    int x = 0;
    for (char c : second) {
      int &y = t[x][c - 'a'];
      if (!y) y = p++;
      x = y;
      pref[x]++;
    }
    fim[x]++;
  }
  void erase(string second) {
    int x = 0;
    for (char c : second) {
      int &y = t[x][c - 'a'];
      x = y, pref[x]--;
      if (!pref[x]) y = 0;
    }
    fim[x]--;
  }
  bool find(string second) {
    int x = 0;
    for (char c : second) {
      x = t[x][c - 'a'];
      if (!x) return false;
    }
    return fim[x];
  }
  int min_xor(string second) {
    int x = 0;
    int ret = 0;
    string er;
    for (int i = 0; i < second.size(); i++) {
      char c = second[i] - 'a';
      if (!t[x][c]) c = !c;
      er += (c + 'a');
      x = t[x][c];
      if (c != (second[i] - 'a')) ret += 1 << (second.size() - i - 1);
    }
    erase(er);
    return ret;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n), w(n);
  for (auto &i : v) cin >> i;
  for (auto &i : w) cin >> i;
  trie t;
  for (auto a : w) {
    string second;
    for (int i = 0; i < 30; i++) second += ('a' + !!(a & 1 << (29 - i)));
    t.insert(second);
  }
  for (auto a : v) {
    string second;
    for (int i = 0; i < 30; i++) second += ('a' + !!(a & 1 << (29 - i)));
    cout << t.min_xor(second) << " ";
  }
  cout << endl;
  exit(0);
}
