#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N], p[N];
struct TRIE {
  int next[N * 40][2];
  int end[N * 40];
  int nm[N * 40];
  int sz;
  void clear() {
    memset(next, -1, sizeof(next));
    memset(end, 0, sizeof(end));
    sz = 0;
  }
  void insert(int num) {
    int v = 0, i;
    for (i = 31; i >= 0; --i) {
      int ind = 0;
      if (num & (1 << i)) {
        ind = 1;
      }
      if (next[v][ind] == -1) {
        next[v][ind] = ++sz;
      }
      v = next[v][ind];
    }
    end[v]++;
    nm[v] = num;
  }
  int search(int num) {
    int v = 0, i, ret = 0, last = 0, dir = 0;
    for (i = 31; i >= 0; --i) {
      int ind = 0;
      if (num & (1 << i)) {
        ind = 1;
      }
      if (next[v][ind] == -1) {
        ret |= (1 << (ind ^ 1));
        v = next[v][ind ^ 1];
      } else {
        ret |= (1 << ind);
        int tm = v;
        if (next[v][ind ^ 1] != -1) {
          last = v;
          dir = ind;
        }
        v = next[v][ind];
      }
    }
    end[v]--;
    if (end[v] == 0) next[last][dir] = -1;
    return nm[v];
  }
} tr;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  tr.clear();
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    tr.insert(p[i]);
  }
  for (int i = 0; i < n; ++i) {
    int tmp = tr.search(a[i]);
    cout << (tmp ^ a[i]) << " ";
  }
}
