#include <bits/stdc++.h>
using namespace std;
struct node {
  node* children[2];
  bool isend;
  long long nleaves;
};
node* newNode() {
  node* x = (node*)malloc(sizeof(node));
  x->children[0] = x->children[1] = NULL;
  x->isend = 0;
  x->nleaves = 0;
  return x;
}
void insert(long long n, node* root) {
  for (long long i = 30; i >= 0; i--) {
    (root->nleaves) += 1;
    long long bit = ((n >> i) & 1);
    if (root->children[bit] == NULL) root->children[bit] = newNode();
    root = root->children[bit];
  }
  root->nleaves += 1;
  root->isend = 1;
}
long long searchDel(long long n, node* root) {
  long long ans = 0, i;
  node* temp = root;
  long long fstring[32];
  root->nleaves -= 1;
  memset(fstring, 0, sizeof fstring);
  for (i = 30; i >= 0; i--) {
    long long bit = ((n >> i) & 1);
    node* child = temp->children[bit];
    if (child == NULL) {
      temp = temp->children[(bit + 1) % 2];
      ans += (1 << i);
    } else {
      (child->nleaves) -= 1;
      if (child->nleaves == 0) {
        temp->children[bit] = NULL;
      }
      temp = child;
    }
  }
  return ans;
}
int main() {
  node* root = newNode();
  long long i, n;
  cin >> n;
  long long a[n + 1], p[n + 1];
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < n; i++) scanf("%lld", &p[i]);
  for (i = 0; i < n; i++) insert(p[i], root);
  for (i = 0; i < n; i++) printf("%lld ", searchDel(a[i], root));
  cout << endl;
  return 0;
}
