#include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 1e18;
template <typename T>
inline bool chkmax(T& aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
const long long mn = 2e5 + 4;
long long b[mn], c[mn], a[mn];
long long p[mn], q[mn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) scanf("%lld", b + i);
  for (long long i = 0; i < n; i++) scanf("%lld", c + i);
  if (n == 1) {
    a[0] = b[0];
  } else {
    long long s = 0;
    for (long long i = 0; i < n; i++) s += b[i] + c[i];
    s /= (2 * n);
    for (long long i = 0; i < n; i++) a[i] = (b[i] + c[i] - s) / (n);
  }
  memset(p, 0, sizeof p);
  memset(q, 0, sizeof q);
  for (long long k = 0; k < 31; k++) {
    long long t[2];
    t[0] = 0;
    t[1] = 0;
    for (long long i = 0; i < n; i++) {
      t[1 & (a[i] >> k)]++;
    }
    for (long long i = 0; i < n; i++) {
      long long self = 1 & (a[i] >> k);
      if (self == 1) {
        p[i] += (1ll << k) * t[1];
        q[i] += (1ll << k) * n;
      } else {
        q[i] += (1ll << k) * t[1];
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    if (p[i] != b[i] || q[i] != c[i]) {
      printf("-1\n");
      return 0;
    }
  }
  for (long long i = 0; i < n; i++) printf("%lld ", a[i]);
  printf("\n");
}
