#include <bits/stdc++.h>
using namespace std;
int n;
int a[300010];
int p[300010];
struct node {
  int next[2] = {};
  int cnt = 0;
  int par;
};
node t[31 * 300010];
int root = 1;
int E = 2;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> 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++) {
    int u = root;
    for (int j = 29; j >= 0; j--) {
      int c;
      if (p[i] & (1 << j))
        c = 1;
      else
        c = 0;
      if (!t[u].next[c]) {
        t[u].next[c] = E++;
        t[E - 1].par = u;
      }
      u = t[u].next[c];
    }
    while (u != 1) {
      t[u].cnt++;
      u = t[u].par;
    }
  }
  for (int i = 0; i < n; i++) {
    int x = a[i];
    int u = root;
    int val = 0;
    for (int j = 29; j >= 0; j--) {
      int c;
      if (a[i] & (1 << j))
        c = 1;
      else
        c = 0;
      if (t[u].next[c] && t[t[u].next[c]].cnt) {
        val ^= (1 << j) * c;
        u = t[u].next[c];
      } else {
        val ^= (1 << j) * (!c);
        u = t[u].next[!c];
      }
    }
    while (u != 0) {
      t[u].cnt--;
      u = t[u].par;
    }
    x ^= val;
    cout << x << ' ';
  }
}
