#include <bits/stdc++.h>
using namespace std;
struct trie {
  int c0, c1;
  struct trie *zo, *on;
};
struct trie *root = NULL, *curr = NULL;
struct trie *newnode() {
  struct trie *node = (struct trie *)malloc(sizeof(trie));
  node->zo = 0;
  node->on = 0;
  node->c0 = 0;
  node->c1 = 0;
  return node;
}
void build(int num, int add) {
  curr = root;
  for (int i = 30; i >= 0; i--) {
    if (!(num & (1 << i))) {
      if (curr->zo == 0) {
        struct trie *temp = newnode();
        curr->c0 += add;
        curr->zo = temp;
        curr = temp;
      } else {
        curr->c0 += add;
        curr = curr->zo;
      }
    } else {
      if (curr->on == 0) {
        struct trie *temp = newnode();
        curr->c1 += add;
        curr->on = temp;
        curr = temp;
      } else {
        curr->c1 += add;
        curr = curr->on;
      }
    }
  }
}
int query(int num) {
  int made = 0;
  curr = root;
  for (int i = 30; i >= 0; i--) {
    if (num & (1 << i)) {
      if (curr->on && curr->c1) {
        curr = curr->on;
        made |= (1 << i);
        continue;
      }
      if (curr->zo && curr->c0) {
        curr = curr->zo;
      }
    } else {
      if (curr->zo && curr->c0) {
        curr = curr->zo;
        continue;
      }
      if (curr->on && curr->c1) {
        curr = curr->on;
        made |= (1 << i);
      }
    }
  }
  return made;
}
int main() {
  int n;
  cin >> n;
  int a[n + 1], p[n + 1], x, j;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> p[i];
  root = newnode();
  for (int i = 1; i <= n; i++) {
    build(p[i], 1);
  }
  for (int i = 1; i <= n; i++) {
    int p = query(a[i]);
    a[i] = a[i] ^ p;
    build(p, -1);
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
