#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;
const int SIZE = 300000;
const int N = SIZE * 30 + 2;
int a[SIZE];
int siz[N];
int trie[N][2];
int len = 2;
void add(int x) {
  int v = 1;
  for (int i = (30); i >= (0); --i) {
    siz[v]++;
    int bit = (x >> i) & 1;
    if (!trie[v][bit]) trie[v][bit] = len++;
    v = trie[v][bit];
  }
  siz[v]++;
}
int get(int val) {
  int v = 1;
  int ret = 0;
  for (int i = (30); i >= (0); --i) {
    siz[v]--;
    int bit = (val >> i) & 1;
    if (!trie[v][bit] || !siz[trie[v][bit]]) {
      bit ^= 1;
      ret |= 1 << i;
    }
    v = trie[v][bit];
  }
  siz[v]--;
  return ret;
}
void solve() {
  int n, x;
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  for (int i = 0; i < (n); ++i) {
    cin >> x;
    add(x);
  }
  for (int i = 0; i < (n); ++i) cout << get(a[i]) << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
