#include <bits/stdc++.h>
using namespace std;
const int N = 5005000;
int a[N][2], s[N];
int b[N];
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  int cnt = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    int root = 1;
    s[root]++;
    for (int j = 30; j >= 0; j--) {
      int way = 0;
      if (x & (1 << j)) {
        way = 1;
      } else
        way = 0;
      if (a[root][way] == 0) {
        a[root][way] = ++cnt;
      }
      root = a[root][way];
      s[root]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    int root = 1;
    int ans = 0;
    for (int j = 30; j >= 0; j--) {
      int y = 0;
      int want = 0;
      if (b[i] & (1 << j)) {
        y = 1;
      }
      if (y == 0) {
        want = 0;
      } else
        want = 1;
      if (s[a[root][want]] != 0) {
        root = a[root][want];
        ans += (1 << j) * want;
        s[root]--;
      } else {
        want ^= 1;
        root = a[root][want];
        ans += (1 << j) * want;
        s[root]--;
      }
    }
    cout << (ans ^ b[i]) << " ";
  }
  return 0;
}
