#include <bits/stdc++.h>
using namespace std;
struct node {
  int end, f;
  node *al[2];
};
node *root;
void add(string s) {
  auto n = root;
  for (char c : s) {
    int i = c - '0';
    if (n->al[i] == NULL) n->al[i] = new node();
    n = n->al[i];
    ++n->f;
  }
  ++n->end;
}
void del(string s) {
  auto n = root;
  for (char c : s) {
    int i = c - '0';
    n = n->al[i];
    --n->f;
  }
  --n->end;
}
int search(string s) {
  int ans = 0;
  string ss;
  auto n = root;
  for (int j = 0; j < s.size(); j++) {
    int i = s[j] - '0';
    if (n->al[i] && n->al[i]->f) {
      n = n->al[i];
      ss += s[j];
    } else {
      ans += 1 << (30 - j);
      n = n->al[1 - i];
      ss += (s[j] == '1' ? '0' : '1');
    }
    --n->f;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  root = new node();
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    string s;
    for (int j = 30; j >= 0; j--) {
      if (b[i] & (1 << j))
        s += '1';
      else
        s += '0';
    }
    add(s);
  }
  for (int e : a) {
    string s;
    for (int j = 30; j >= 0; j--) {
      if (e & (1 << j))
        s += '1';
      else
        s += '0';
    }
    cout << search(s) << ' ';
  }
}
