#include <bits/stdc++.h>
using namespace std;
int dcmp(double x, double y) {
  return fabs(x - y) <= 1e-9 ? 0 : x < y ? -1 : 1;
}
const int MAX = 300010;
int A[MAX], n, tmp;
struct NODE {
  NODE *one, *zero;
  int cnt;
  NODE() {
    cnt = 0;
    one = zero = 0;
  }
};
bool get_count(NODE *t) {
  if (t == 0)
    return 0;
  else
    return t->cnt;
}
void _add(NODE *t, int num, int bit) {
  t->cnt++;
  if (bit == -1) return;
  if (num & (1 << bit)) {
    if (t->one == 0) t->one = new NODE();
    _add(t->one, num, bit - 1);
  } else {
    if (t->zero == 0) t->zero = new NODE();
    _add(t->zero, num, bit - 1);
  }
}
int query(NODE *t, int num, int bit) {
  t->cnt--;
  if (bit == -1) return 0;
  if (num & (1 << bit)) {
    if (get_count(t->one)) {
      return (1 << bit) + query(t->one, num, bit - 1);
    } else {
      return query(t->zero, num, bit - 1);
    }
  } else {
    if (get_count(t->zero)) {
      return query(t->zero, num, bit - 1);
    } else {
      return (1 << bit) + query(t->one, num, bit - 1);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  NODE *root = new NODE();
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < (int)(n); ++i) {
    cin >> tmp;
    _add(root, tmp, 30);
  }
  for (int i = 0; i < (int)(n); ++i) {
    int y = query(root, A[i], 30);
    cout << (y ^ A[i]) << ' ';
  }
}
