#include <bits/stdc++.h>
using namespace std;
struct vertex {
  int nxt[2], cnt;
  vertex() {
    nxt[0] = nxt[1] = -1;
    cnt = 0;
  }
} t[4000000];
int sz = 1;
void add(string s) {
  int v = 0;
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - '0';
    if (t[v].nxt[c] == -1) {
      t[v].nxt[c] = sz++;
    }
    v = t[v].nxt[c];
    t[v].cnt++;
  }
}
void erase_e(string s) {
  int v = 0;
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - '0';
    v = t[v].nxt[c];
    t[v].cnt--;
  }
}
string get(int x) {
  int v = 0;
  string s = "";
  for (int i = 30; i >= 0; i--) {
    if ((x >> i) & 1) {
      if (t[v].nxt[1] == -1 || t[t[v].nxt[1]].cnt == 0) {
        v = t[v].nxt[0];
        s += '0';
      } else {
        v = t[v].nxt[1];
        s += '1';
      }
    } else {
      if (t[v].nxt[0] == -1 || t[t[v].nxt[0]].cnt == 0) {
        v = t[v].nxt[1];
        s += '1';
      } else {
        v = t[v].nxt[0];
        s += '0';
      }
    }
  }
  return s;
}
long long n, a[300001], b[300001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int j = 1; j <= n; j++) {
    cin >> b[j];
    string s;
    for (int i = 30; i >= 0; i--) {
      if ((b[j] >> i) & 1) {
        s += '1';
      } else {
        s += '0';
      }
    }
    add(s);
  }
  for (int i = 1; i <= n; i++) {
    string s = get(a[i]);
    int ans = 0;
    int step = 0;
    for (int j = s.size() - 1; j >= 0; j--) {
      if (s[j] == '1') {
        ans += (1 << step);
      }
      step++;
    }
    cout << (a[i] ^ ans) << " ";
    erase_e(s);
  }
}
