#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int p[1000005];
int o[1000005];
string str;
struct trie {
  int ct;
  int fin;
  struct trie *sons[2];
};
struct trie *root;
struct trie *newnode() {
  struct trie *x;
  x = (struct trie *)malloc(sizeof(struct trie));
  x->ct = 0;
  x->fin = 0;
  for (int i = 0; i < 2; i++) x->sons[i] = NULL;
  return x;
};
void insert() {
  struct trie *node = root;
  int mar = str.length();
  string ch = str;
  for (int i = 0; i < mar; i++) {
    if (node->sons[ch[i] - '0'] == NULL) node->sons[ch[i] - '0'] = newnode();
    node = node->sons[ch[i] - '0'];
    ++node->ct;
  }
  ++node->fin;
}
void delet() {
  struct trie *node = root;
  struct trie *node2;
  string ch = str;
  int mar = str.length();
  for (int i = 0; i < mar; i++) {
    node2 = node->sons[ch[i] - '0'];
    --node2->ct;
    if (node2->ct == 0) node->sons[ch[i] - '0'] = NULL;
    if (node->ct == 0) free(node);
    node = node2;
  }
  --node2->fin;
}
string str3;
string search() {
  struct trie *node = root;
  int mar = str.length();
  string ch = str;
  string str2 = "";
  str3 = "";
  for (int i = 0; i < mar; i++) {
    if (str[i] == '1') {
      if (node->sons[1]) {
        str2 += "0";
        node = node->sons[1];
        str3 += "1";
      } else {
        str2 += "1";
        node = node->sons[0];
        str3 += "0";
      }
    } else {
      if (node->sons[0]) {
        str2 += "0";
        node = node->sons[0];
        str3 += "0";
      } else {
        str2 += "1";
        node = node->sons[1];
        str3 += "1";
      }
    }
  }
  return str2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i, j, k, l, m, n, t, r, cnt;
  int flag = 0;
  long long ans = 0, an = 0;
  t = 1;
  while (t--) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    string str2;
    root = newnode();
    for (i = 0; i < n; i++) {
      scanf("%d", &p[i]);
      str = "";
      for (j = 30; j >= 0; j--) {
        str += (char)(((p[i] >> j) & 1) + '0');
      }
      insert();
    }
    for (i = 0; i < n; i++) {
      str = "";
      for (j = 30; j >= 0; j--) {
        str += (char)(((a[i] >> j) & 1) + '0');
      }
      str2 = search();
      str = str3;
      delet();
      for (j = 0; j < str2.length(); j++) {
        if (str2[j] == '1') {
          o[i] += (1 << (30 - j));
        }
      }
      cout << o[i] << " ";
    }
    cout << endl;
  }
}
