#include <bits/stdc++.h>
using namespace std;
char *to_char(long long x) {
  char *rez = new char[32];
  for (int i = 31; i >= 0; i--) {
    if ((x & 1LL) == 1LL)
      rez[i] = '1';
    else
      rez[i] = '0';
    x = x / 2LL;
  }
  return rez;
}
struct node {
  int c0;
  int c1;
  node *d0;
  node *d1;
  node() {
    c0 = 0;
    c1 = 0;
    d0 = 0;
    d1 = 0;
  }
};
void dfs(node *tree, char *str, int now) {
  if (now == 32) return;
  if (str[now] == '0') {
    tree->c0++;
    if (tree->d0 == 0) tree->d0 = new node();
    dfs(tree->d0, str, now + 1);
  } else {
    tree->c1++;
    if (tree->d1 == 0) tree->d1 = new node();
    dfs(tree->d1, str, now + 1);
  }
}
void find_min(node *tree, char *str, int now, long long &val) {
  if (now == 32) return;
  if (tree->c1 == 0) {
    tree->c0--;
    find_min(tree->d0, str, now + 1, val);
  } else if (tree->c0 == 0) {
    tree->c1--;
    val ^= (1LL << (31 - now));
    find_min(tree->d1, str, now + 1, val);
  } else if (str[now] == '0') {
    tree->c0--;
    find_min(tree->d0, str, now + 1, val);
  } else {
    tree->c1--;
    val ^= (1LL << (31 - now));
    find_min(tree->d1, str, now + 1, val);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  long long *mas = new long long[n], *arr = new long long[n];
  node *tree = new node();
  for (int i = 0; i < n; i++) scanf("%I64d", &mas[i]);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &arr[i]);
    char *str = to_char(arr[i]);
    dfs(tree, str, 0);
    delete[] str;
  }
  for (int i = 0; i < n; i++) {
    fflush(stdout);
    char *str = to_char(mas[i]);
    find_min(tree, str, 0, mas[i]);
    printf("%I64d ", mas[i]);
  }
  return 0;
}
