#include <bits/stdc++.h>
using namespace std;
long long n, i, j, a[200002], b[200002], c[200002], cnt[200002];
long long read() {
  char c = getchar();
  long long w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
signed main() {
  n = read();
  for (i = 1; i <= n; i++) b[i] = read();
  for (i = 1; i <= n; i++) c[i] = read();
  long long sum = 0;
  for (i = 1; i <= n; i++) sum += b[i] + c[i];
  sum /= 2 * n;
  for (i = 1; i <= n; i++) {
    if ((b[i] + c[i] - sum) % n != 0) {
      puts("-1");
      return 0;
    }
    a[i] = (b[i] + c[i] - sum) / n;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; (1 << j) <= a[i]; j++) {
      if (a[i] & (1 << j)) cnt[j]++;
    }
  }
  for (i = 1; i <= n; i++) {
    long long b1 = 0, c1 = sum;
    for (j = 0; (1 << j) <= a[i]; j++) {
      if (a[i] & (1 << j))
        b1 += (1 << j) * cnt[j], c1 += (1 << j) * (n - cnt[j]);
    }
    if (b1 != b[i] || c1 != c[i]) {
      puts("-1");
      return 0;
    }
  }
  for (i = 1; i <= n; i++) printf("%lld ", a[i]);
  puts("");
  return 0;
}
