#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long double PI = 3.14159265;
long long int powerWithMod(long long int base, long long int exponent,
                           long long int modulus = LLONG_MAX) {
  long long int result = 1;
  base %= modulus;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent >>= 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long int modInverse(long long int a, long long int m = MOD) {
  return powerWithMod(a, m - 2, m);
}
long long int n, b[212345], c[212345], a[212345], bb[212345][32],
    bc[212345][32], cnt[32];
void t() {
  cout << "-1\n";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    if (c[i] < b[i]) t();
  }
  auto s = accumulate(b, b + n, 0LL) + accumulate(c, c + n, 0LL);
  s /= 2 * n;
  for (int i = 0; i < n; i++) a[i] = (b[i] + c[i] - s) / n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 32; j++)
      if (a[i] & (1LL << j)) cnt[j]++;
  for (int i = 0; i < n; i++) {
    long long int currb = 0, currc = 0;
    for (int j = 0; j < 32; j++) {
      if (a[i] & (1LL << j))
        bb[i][j] = cnt[j], bc[i][j] = n;
      else
        bb[i][j] = 0, bc[i][j] = cnt[j];
      currb += bb[i][j] * (1LL << j);
      currc += bc[i][j] * (1LL << j);
    }
    if (currb != b[i] or currc != c[i]) t();
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
