#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200005;
long long n, a[MAXN], b[MAXN], c[MAXN], bitsOfA[35];
void buildBitsArray() {
  for (long long(i) = (long long)(0); (i) <= (long long)(32); (i)++)
    for (long long(j) = (long long)(1); (j) <= (long long)(n); (j)++)
      bitsOfA[i] += ((a[j] & (1ll << i)) > 0);
}
bool check() {
  for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++) {
    long long curC = 0, curB = 0;
    for (long long(j) = (long long)(0); (j) <= (long long)(32); (j)++)
      curC += (n * (a[i] & (1ll << j)) + bitsOfA[j] * (~a[i] & (1ll << j))),
          curB += bitsOfA[j] * (a[i] & (1ll << j));
    if (curC != c[i] || curB != b[i]) return false;
  }
  return true;
}
int main() {
  scanf("%lld", &n);
  for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++)
    scanf("%lld", &b[i]);
  for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++)
    scanf("%lld", &c[i]);
  long long sumD = 0;
  for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++)
    a[i] = b[i] + c[i], sumD += a[i];
  if (sumD % (2 * n)) {
    printf("-1\n");
    return 0;
  }
  long long sumA = sumD / n / 2;
  for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++) {
    a[i] -= sumA;
    if (a[i] < 0 || a[i] % n) {
      printf("-1\n");
      return 0;
    }
    a[i] /= n;
  }
  buildBitsArray();
  if (check())
    for (long long(i) = (long long)(1); (i) <= (long long)(n); (i)++)
      printf("%lld ", a[i]);
  else
    printf("-1");
  printf("\n");
  return 0;
}
