#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int vertex, a[300005], b[300005], max_len = 30;
struct {
  int Null, One, Cnt_one, Cnt_null;
} x[5000005];
map<int, int> was;
void add(int num) {
  int v = 0;
  for (int i = max_len - 1; i >= 0; i--) {
    if (num & (1 << i)) {
      if (!x[v].One) x[v].One = ++vertex;
      v = x[v].One;
      x[v].Cnt_one++;
    } else {
      if (!x[v].Null) x[v].Null = ++vertex;
      v = x[v].Null;
      x[v].Cnt_null++;
    }
  }
}
int Get(int num) {
  int v = 0, res = 0;
  for (int i = max_len - 1; i >= 0; i--) {
    if (num & (1 << i)) {
      if (x[v].One && x[x[v].One].Cnt_one) {
        v = x[v].One;
        x[v].Cnt_one--;
        res += 1 << i;
      } else if (x[v].Null && x[x[v].Null].Cnt_null) {
        v = x[v].Null;
        x[v].Cnt_null--;
      }
    } else {
      if (x[v].Null && x[x[v].Null].Cnt_null) {
        v = x[v].Null;
        x[v].Cnt_null--;
      } else if (x[v].One && x[x[v].One].Cnt_one) {
        v = x[v].One;
        x[v].Cnt_one--;
        res += 1 << i;
      }
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    add(b[i]);
  }
  for (int i = 1; i <= n; i++) {
    int res = Get(a[i]);
    cout << (res ^ a[i]) << " ";
  }
  return 0;
}
