#include <bits/stdc++.h>
using namespace std;
struct vertex {
  int z, o;
  int zz, oo;
  vertex() : z(-1), o(-1), zz(0), oo(0) {}
};
int sz = 1;
vertex vcs[8000000];
void build1(int nc) {
  int l = 29;
  int cur = 0;
  while (l >= 0) {
    if ((1 << l) & nc) {
      if (vcs[cur].o == -1) {
        vcs[cur].o = sz;
        sz++;
      }
      vcs[cur].oo++;
      cur = vcs[cur].o;
    } else {
      if (vcs[cur].z == -1) {
        vcs[cur].z = sz;
        sz++;
      }
      vcs[cur].zz++;
      cur = vcs[cur].z;
    }
    l--;
  }
}
void miniKek(int nc) {
  int l = 29;
  int cur = 0;
  int kaka = 0;
  while (l >= 0) {
    if ((1 << l) & nc) {
      if (vcs[cur].oo) {
        kaka |= (1 << l);
        vcs[cur].oo--;
        cur = vcs[cur].o;
        l--;
        continue;
      }
      if (vcs[cur].zz) {
        vcs[cur].zz--;
        cur = vcs[cur].z;
        l--;
        continue;
      }
    } else {
      if (vcs[cur].zz) {
        vcs[cur].zz--;
        cur = vcs[cur].z;
        l--;
        continue;
      }
      if (vcs[cur].oo) {
        kaka |= (1 << l);
        vcs[cur].oo--;
        cur = vcs[cur].o;
        l--;
        continue;
      }
    }
    cout << "WHAT" << endl;
  }
  cout << (kaka ^ nc) << ' ';
}
int main() {
  int n;
  cin >> n;
  vector<int> vc;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    vc.push_back(t);
  }
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    build1(t);
  }
  for (auto i : vc) {
    miniKek(i);
  }
  return 0;
}
