#include <bits/stdc++.h>
using namespace std;
const int nmax = 200009;
int a[nmax], b[nmax], c[nmax], sum, i, n, used[nmax], bp[nmax], cp[nmax], j,
    flag;
long long st;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
    st += b[i];
  }
  for (i = 1; i <= n; ++i) {
    scanf("%d", &c[i]);
    st += c[i];
  }
  if (st % (n + n) == 0)
    sum = st / (n + n);
  else {
    printf("-1\n");
    return 0;
  }
  for (i = 1; i <= n; ++i) {
    if ((b[i] + c[i] - sum) % n) {
      printf("-1\n");
      return 0;
    }
    a[i] = (b[i] + c[i] - sum) / n;
  }
  for (i = 1; i <= n; ++i) {
    for (j = 0; j <= 30; ++j)
      if (a[i] & (1 << j)) used[j]++;
  }
  for (i = 1; i <= n; ++i) {
    for (j = 0; j <= 30; ++j)
      if (a[i] & (1 << j)) {
        bp[i] += (1 << j) * used[j];
        cp[i] += n * (1 << j);
      } else
        cp[i] += (1 << j) * used[j];
  }
  flag = 1;
  for (i = 1; i <= n; ++i) flag &= (bp[i] == b[i] && cp[i] == c[i]);
  if (flag) {
    for (i = 1; i <= n; ++i) printf("%d\n", a[i]);
  } else
    printf("-1\n");
  return 0;
}
