#include <bits/stdc++.h>
using namespace std;
const int stala = 300010;
int ciag[stala];
int ciag2[stala];
int sasiedzi[32 * stala][2];
int ile_sciezek[32 * stala];
int potega[31];
int max_index = 1;
int do_usuniecia, res;
void pre() {
  potega[0] = 1;
  for (int i = 1; i <= 29; i++) {
    potega[i] = potega[i - 1] * 2;
  }
}
void dodaj(int war) {
  int index = 1;
  for (int i = 29; i >= 0; i--) {
    int pom = war / potega[i];
    war -= pom * potega[i];
    if (sasiedzi[index][pom] == 0) {
      max_index++;
      sasiedzi[index][pom] = max_index;
    }
    index = sasiedzi[index][pom];
    ile_sciezek[index]++;
  }
}
void szukaj(int war) {
  int index = 1;
  for (int i = 29; i >= 0; i--) {
    int pom = war / potega[i];
    war -= pom * potega[i];
    if (sasiedzi[index][pom] > 0) {
      index = sasiedzi[index][pom];
      if (pom == 1) {
        do_usuniecia += potega[i];
      }
    } else {
      index = sasiedzi[index][(pom + 1) % 2];
      res += potega[i];
      if ((pom + 1) % 2 == 1) {
        do_usuniecia += potega[i];
      }
    }
  }
}
void usun(int war) {
  int index = 1;
  for (int i = 29; i >= 0; i--) {
    int pom = war / potega[i];
    war -= pom * potega[i];
    int index2 = index;
    index = sasiedzi[index][pom];
    ile_sciezek[index]--;
    if (ile_sciezek[index] == 0) {
      sasiedzi[index2][pom] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pre();
  int ile;
  cin >> ile;
  for (int i = 1; i <= ile; i++) {
    cin >> ciag[i];
  }
  for (int i = 1; i <= ile; i++) {
    cin >> ciag2[i];
  }
  for (int i = 1; i <= ile; i++) {
    dodaj(ciag2[i]);
  }
  for (int i = 1; i <= ile; i++) {
    do_usuniecia = 0;
    res = 0;
    szukaj(ciag[i]);
    cout << res << " ";
    usun(do_usuniecia);
  }
  return 0;
}
