#include <bits/stdc++.h>
using namespace std;
const int MAXBUF = 10000;
char buf[MAXBUF], *ps = buf, *pe = buf + 1;
inline bool isdigit(const char &n) { return (n >= '0' && n <= '9'); }
inline void rnext() {
  if (++ps == pe)
    pe = (ps = buf) +
         fread(buf, sizeof(char), sizeof(buf) / sizeof(char), stdin);
}
template <class T>
inline bool in(T &ans) {
  ans = 0;
  T f = 1;
  if (ps == pe) return false;
  do {
    rnext();
    if ('-' == *ps) f = -1;
  } while (!isdigit(*ps) && ps != pe);
  if (ps == pe) return false;
  do {
    ans = (ans << 1) + (ans << 3) + *ps - 48;
    rnext();
  } while (isdigit(*ps) && ps != pe);
  ans *= f;
  return true;
}
const int MAXOUT = 10000;
char bufout[MAXOUT], outtmp[50], *pout = bufout, *pend = bufout + MAXOUT;
inline void write() {
  fwrite(bufout, sizeof(char), pout - bufout, stdout);
  pout = bufout;
}
inline void out_char(char c) {
  *(pout++) = c;
  if (pout == pend) write();
}
inline void out_str(char *s) {
  while (*s) {
    *(pout++) = *(s++);
    if (pout == pend) write();
  }
}
template <class T>
inline void out_int(T x) {
  if (!x) {
    out_char('0');
    return;
  }
  if (x < 0) x = -x, out_char('-');
  int len = 0;
  while (x) {
    outtmp[len++] = x % 10 + 48;
    x /= 10;
  }
  outtmp[len] = 0;
  for (int i = 0, j = len - 1; i < j; i++, j--) swap(outtmp[i], outtmp[j]);
  out_str(outtmp);
}
template <typename T, typename... T2>
inline int in(T &value, T2 &...value2) {
  in(value);
  return in(value2...);
}
const double eps = 1e-9;
const int maxn = 3e5 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int N, M, tmp, K;
int a[maxn], b[maxn];
struct node {
  node *Next[2];
  int sum, num;
};
void insert(node *head, int x) {
  node *p = head;
  for (int i = 30; i >= 0; i--) {
    int k = (x >> i) & 1;
    if (!(p->Next[k])) {
      node *q = new node();
      q->sum = 0;
      p->Next[k] = q;
    }
    p = p->Next[k];
    p->sum++;
  }
  p->num = x;
}
int search(node *head, int x) {
  node *p = head;
  for (int i = 30; i >= 0; i--) {
    int k = (x >> i) & 1;
    if (p->Next[k] && p->Next[k]->sum)
      p = p->Next[k];
    else
      p = p->Next[k ^ 1];
    p->sum--;
  }
  return p->num;
}
int main() {
  scanf("%d", &N);
  node *head = new node();
  for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= N; i++) scanf("%d", &b[i]), insert(head, b[i]);
  for (int i = 1; i <= N; i++) {
    int ans = search(head, a[i]);
    printf("%d ", ans ^ a[i]);
  }
  return 0;
}
