#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  node *next[2];
  int cnt;
  node() {
    for (int i = 0; i < 2; i++) {
      next[i] = nullptr;
    }
    cnt = 0;
  }
};
node *root = new node();
void add(bitset<30> &bit, int pos, node *v = root) {
  if (pos < 0) return;
  int x = bit[pos];
  if (v->next[x] == nullptr) {
    v->next[x] = new node();
  }
  v->next[x]->cnt++;
  add(bit, pos - 1, v->next[x]);
}
int f(bitset<30> &bit, int pos, node *v = root) {
  if (pos < 0) return 0;
  int res = 0;
  int x = bit[pos];
  if (v->next[x] != nullptr) {
    if (x == 1) {
      res += (1 << pos);
    }
    res += f(bit, pos - 1, v->next[x]);
    v->next[x]->cnt--;
    if (v->next[x]->cnt == 0) {
      v->next[x] = nullptr;
    }
  } else {
    if (x ^ 1 == 1) {
      res += (1 << pos);
    }
    res += f(bit, pos - 1, v->next[x ^ 1]);
    v->next[x ^ 1]->cnt--;
    if (v->next[x ^ 1]->cnt == 0) {
      v->next[x ^ 1] = nullptr;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  int a[n];
  int p[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    bitset<30> y = p[i];
    add(y, 29);
  }
  for (int i = 0; i < n; i++) {
    bitset<30> y = a[i];
    int ot = (f(y, 29) ^ a[i]);
    cout << ot << " ";
  }
}
