#include <bits/stdc++.h>
using namespace std;
struct Bor {
  struct Node {
    int count;
    Node *child[2];
    Node() {
      count = 0;
      child[0] = NULL;
      child[1] = NULL;
    }
  };
  Node *root = new Node();
  void add(int x) {
    Node *node = root;
    for (int i = 30; i > 0; i--) {
      int bit = (x >> (i - 1)) & 1;
      if (node->child[bit] == NULL) node->child[bit] = new Node();
      node = node->child[bit];
    }
    node->count++;
  }
  int findSimilar(int x) {
    int ans = 0;
    Node *node = root;
    for (int i = 30; i > 0; i--) {
      int bit = (x >> (i - 1)) & 1;
      ans = (ans << 1) + ((node->child[bit] != NULL) ? bit : 1 - bit);
      node = ((node->child[bit] != NULL) ? node->child[bit]
                                         : node->child[1 - bit]);
    }
    return ans;
  }
  void remove(int x) {
    Node *node = root;
    int height = 30;
    for (int i = 30; i > 0; i--) {
      int bit = (x >> (i - 1)) & 1;
      if ((node->child[0] != NULL) && (node->child[1] != NULL)) height = i;
      node = node->child[bit];
    }
    node->count--;
    if (node->count == 0) {
      node = root;
      for (int i = 30; i > height; i--) {
        int bit = (x >> (i - 1)) & 1;
        node = node->child[bit];
      }
      node->child[(x >> (height - 1)) & 1] = NULL;
    }
  }
};
int main() {
  int n;
  scanf("%d", &n);
  Bor tree = Bor();
  vector<int> v(n), ans(n);
  for (int &el : v) scanf("%d", &el);
  for (int i = 0; i < n; i++) {
    int key;
    scanf("%d", &key);
    tree.add(key);
  }
  for (int &el : v) {
    int key = tree.findSimilar(el);
    printf("%d ", el ^ key);
    tree.remove(key);
  }
}
