#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> b(n), c(n), a(n);
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &b[i]);
    sum += b[i];
  }
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &c[i]);
    sum += c[i];
  }
  sum /= (n * 2);
  for (int i = 0; i < n; ++i) a[i] = (b[i] + c[i] - sum) / n;
  bool ok = true;
  long long total_bits[60] = {};
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 60; ++j)
      if ((1LL << j) & a[i]) ++total_bits[j];
  for (int i = 0; i < n; ++i) {
    long long b_exp = 0, c_exp = 0;
    for (int j = 0; j < 60; ++j)
      if ((1LL << j) & a[i]) {
        b_exp += total_bits[j] << j;
        c_exp += n << j;
      } else {
        b_exp += 0;
        c_exp += total_bits[j] << j;
      }
    if (b_exp != b[i] || c_exp != c[i]) {
      ok = false;
      break;
    }
  }
  if (!ok) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < n; ++i) printf("%lld%c", a[i], " \n"[i == n - 1]);
}
