#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3F3F3F3F;
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-8;
int cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
vector<long long> computeOr(const vector<long long>& a) {
  array<int, 63> qtd;
  for (__decltype(63) i = (0); i < (63); ++i) qtd[i] = 0;
  for (long long x : a)
    for (__decltype(63ll) i = (0); i < (63ll); ++i)
      if ((x >> i) & 1) qtd[i]++;
  vector<long long> ans;
  ans.reserve(a.size());
  for (long long x : a) {
    long long val = 0;
    for (__decltype(63ll) i = (0); i < (63ll); ++i) {
      if ((x >> i) & 1)
        val += a.size() << i;
      else
        val += qtd[i] << i;
    }
    ans.push_back(val);
  }
  return ans;
}
vector<long long> computeAnd(const vector<long long>& a) {
  array<int, 63> qtd;
  for (__decltype(63) i = (0); i < (63); ++i) qtd[i] = 0;
  for (long long x : a)
    for (__decltype(63ll) i = (0); i < (63ll); ++i)
      if ((x >> i) & 1) qtd[i]++;
  vector<long long> ans;
  ans.reserve(a.size());
  for (long long x : a) {
    long long val = 0;
    for (__decltype(63ll) i = (0); i < (63ll); ++i)
      if ((x >> i) & 1) val += qtd[i] << i;
    ans.push_back(val);
  }
  return ans;
}
int main() {
  int N;
  scanf("%d", &N);
  vector<long long> b(N), c(N);
  for (long long& x : b) scanf("%lld", &x);
  for (long long& x : c) scanf("%lld", &x);
  long long s = 0;
  for (__decltype(N) i = (0); i < (N); ++i) s += c[i] + b[i];
  if (s % (2 * N) != 0) {
    printf("-1\n");
    return 0;
  }
  s /= 2 * N;
  vector<long long> a(N);
  for (__decltype(N) i = (0); i < (N); ++i) {
    a[i] = b[i] + c[i] - s;
    if (a[i] < 0 || a[i] % N != 0) {
      printf("-1\n");
      return 0;
    }
    a[i] /= N;
  }
  if (b != computeAnd(a) || c != computeOr(a)) {
    printf("-1\n");
  } else {
    for (__decltype(N) i = (0); i < (N); ++i) printf("%lld ", a[i]);
    printf("\n");
  }
  return 0;
}
