#include <bits/stdc++.h>
using namespace std;
int Int() {
  int x;
  scanf("%d", &x);
  return x;
}
long long Long() {
  long long x;
  scanf("%lld", &x);
  return x;
}
double Double() {
  double x;
  scanf("%lf", &x);
  return x;
}
const int N = 3 * (int)1e5 + 5;
const long long MOD = (int)1e9 + 7;
struct Trie {
  Trie* path[2];
  int mark;
  Trie() {
    path[0] = path[1] = NULL;
    mark = 0;
  }
} * root;
void insert(int x) {
  Trie* cur = root;
  for (int i = 30; i >= 0; i--) {
    int id = (bool)(x & (1 << i));
    if (cur->path[id] == NULL) cur->path[id] = new Trie();
    cur = cur->path[id];
    cur->mark++;
  }
}
int search(int x) {
  int ret = 0;
  Trie* cur = root;
  for (int i = 30; i >= 0; i--) {
    int id = (bool)(x & (1 << i));
    if (cur->path[id] != NULL and cur->path[id]->mark > 0) {
      cur = cur->path[id];
      cur->mark--;
    } else {
      ret |= (1 << i);
      cur = cur->path[(bool)(id ^ 1)];
      cur->mark--;
    }
  }
  return ret;
}
int arr[N];
int main() {
  root = new Trie();
  int n = Int();
  for (int i = 0; i < n; i++) arr[i] = Int();
  for (int i = 0; i < n; i++) insert(Int());
  for (int i = 0; i < n; i++) {
    cout << search(arr[i]) << " ";
  }
  cout << '\n';
  return 0;
}
