#include <bits/stdc++.h>
using namespace std;
struct trie {
  int cnt, nrfii, here;
  trie *f[2];
  trie() {
    cnt = nrfii = here = 0;
    memset(f, 0, sizeof(f));
  }
};
const int nmax = 300005;
trie *rad = new trie;
int n, v[nmax], c[nmax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    int x = c[i];
    int pw = (1 << 29);
    trie *t = rad;
    while (pw) {
      int bit = 0;
      if (x >= pw) x -= pw, ++bit;
      if (t->f[bit] == NULL) {
        ++t->nrfii;
        t->f[bit] = new trie;
        ++t->f[bit]->cnt;
      } else
        ++t->f[bit]->cnt;
      t = t->f[bit];
      pw /= 2;
    }
  }
  for (int i = 1; i <= n; ++i) {
    int x = v[i], sol = 0;
    int pw = (1 << 29);
    trie *t = rad;
    while (pw) {
      int bit = 0;
      if (x >= pw) {
        x -= pw;
        ++bit;
      }
      if (t->f[bit] != NULL) {
        if (bit) sol += pw;
        t = t->f[bit];
      } else {
        if (!bit) sol += pw;
        t = t->f[!bit];
      }
      pw /= 2;
    }
    cout << (sol ^ v[i]) << " ";
    t = rad;
    pw = (1 << 29);
    while (pw) {
      int bit = 0;
      if (sol >= pw) sol -= pw, ++bit;
      if (t->f[bit]->cnt == 1) {
        delete t->f[bit];
        t->f[bit] = NULL;
        --t->nrfii;
        break;
      }
      --t->f[bit]->cnt;
      t = t->f[bit];
      pw /= 2;
    }
  }
  return 0;
}
