#include <bits/stdc++.h>
using namespace std;
struct node {
  int val[2];
  int to[2];
  node() {
    to[0] = to[1] = -1;
    val[0] = val[1] = 0;
  }
};
vector<node> v;
void add(int w, int y) {
  int x = 0;
  int ck;
  for (int i = 31; i >= 0; i--) {
    if ((w & (1 << i)) > 0)
      ck = 1;
    else
      ck = 0;
    if (v[x].to[ck] == -1) {
      v.push_back(node());
      v[x].to[ck] = v.size() - 1;
    }
    v[x].val[ck] += y;
    x = v[x].to[ck];
  }
}
int chk(int w) {
  int x = 0;
  int ck;
  int ans = 0;
  for (int i = 31; i >= 0; i--) {
    if ((w & (1 << i)) > 0)
      ck = 1;
    else
      ck = 0;
    if (v[x].val[ck] <= 0) {
      ck = ck ^ 1;
    }
    x = v[x].to[ck];
    if (ck == 1) ans = ans + (1 << i);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  v.push_back(node());
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    add(x, 1);
  }
  for (int i = 0; i < n; i++) {
    int val = chk(a[i]);
    a[i] = (a[i] ^ val);
    add(val, -1);
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
