#include <bits/stdc++.h>
using namespace std;
struct Node {
  vector<int> x;
  vector<Node *> s;
  Node() {
    x.resize(2);
    x[0] = x[1] = 0;
    s.resize(2);
    s[0] = s[1] = NULL;
  }
};
Node *t = new Node();
void dfs(int x) {
  Node *p = t;
  for (int i = 0; i < 31; i++) {
    int c = (x >> (30 - i)) & 1;
    p->x[c]++;
    if (p->x[c] == 1) {
      p->s[c] = new Node();
    }
    p = p->s[c];
  }
}
int _dfs(int x) {
  int res = 0;
  Node *p = t;
  for (int i = 0; i < 31; i++) {
    int c = (x >> (30 - i)) & 1;
    if (p->x[c] == 0) {
      p->x[1 - c]--;
      res += 1 << (30 - i);
      p = p->s[1 - c];
    } else {
      p->x[c]--;
      p = p->s[c];
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<int> a(n), p(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++) {
    dfs(p[i]);
  }
  for (int i = 0; i < n; i++) cout << _dfs(a[i]) << ' ';
  return 0;
}
