#include <bits/stdc++.h>
struct node {
  int size;
  node *left, *right;
  node() : left(0), right(0), size(0) {}
};
node *root;
int A[300001];
void insert(int value) {
  node *curr = root;
  int mask = 1 << 30;
  while (mask >>= 1) {
    curr->size++;
    if (value & mask) {
      if (!curr->right) {
        curr->right = new node();
      }
      curr = curr->right;
    } else {
      if (!curr->left) {
        curr->left = new node();
      }
      curr = curr->left;
    }
  }
  curr->size++;
}
int findBest(int value) {
  node *curr = root;
  int mask = 1 << 30;
  int result = 0;
  node *prev = 0;
  while (mask >>= 1) {
    curr->size--;
    if (prev && curr->size == 0) {
      if (prev->left == curr) {
        prev->left = 0;
      } else {
        prev->right = 0;
      }
    }
    prev = curr;
    if (!curr->left) {
      curr = curr->right;
      result |= mask;
    } else if (!curr->right) {
      curr = curr->left;
    } else if (mask & value) {
      curr = curr->right;
      result |= mask;
    } else {
      curr = curr->left;
    }
    if (prev->size == 0) {
      delete prev;
      prev = 0;
    }
  }
  curr->size--;
  if (prev && curr->size == 0) {
    if (prev->left == curr) {
      prev->left = 0;
    } else {
      prev->right = 0;
    }
    delete curr;
  }
  return result;
}
int main() {
  root = new node();
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i < n; i++) {
    int next;
    scanf("%d", &next);
    insert(next);
  }
  for (int i = 0; i < n; i++) {
    int res = findBest(A[i]);
    printf("%d ", A[i] ^ res);
  }
  return 0;
}
