#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int a[maxn], p[maxn];
int ft[maxn], n;
void update(int x, int dx) {
  for (; x <= n; x += x & (-x)) ft[x] += dx;
}
int sum(int x) {
  int res = 0;
  for (; x; x -= x & (-x)) res += ft[x];
  return res;
}
int ask(int a, int b) {
  if (a > b) return 0;
  return sum(b) - sum(a - 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) update(i, 1);
  int lim = 29;
  for (int i = 1; i <= n; i++) {
    int lo = 1, hi = n;
    for (int bit = lim; bit >= 0; bit--) {
      int L = lo, R = hi;
      while (L < R) {
        int M = (L + R + 1) / 2;
        if ((1 << bit) & p[M])
          R = M - 1;
        else
          L = M;
      }
      if (p[L] & (1 << bit))
        lo = L;
      else if (ask(lo, L) <= 0)
        lo = L + 1;
      else if (ask(L + 1, hi) <= 0)
        hi = L;
      else if (a[i] & (1 << bit))
        lo = L + 1;
      else
        hi = L;
    }
    printf("%d ", a[i] ^ p[lo]);
    update(lo, -1);
  }
  printf("\n");
}
