#include <bits/stdc++.h>
using namespace std;
int n;
long long b[200050], c[200050];
long long sum = 0;
long long a[200050];
long long num[64];
long long num2[64];
int pos = 0;
int check() {
  long long s = 0;
  memset(num, 0, sizeof(num));
  for (int i = 0; i < n; i++) {
    s += a[i];
    long long x = a[i];
    pos = 0;
    while (x) {
      num[pos++] += x % 2;
      x /= (long long)2;
    }
  }
  for (int i = 0; i < n; i++) {
    memset(num2, 0, sizeof(num2));
    long long x = a[i];
    long long su = 0;
    pos = 0;
    while (x) {
      num2[pos++] = x % 2;
      x /= (long long)2;
    }
    long long temp = 1;
    for (int j = 0; j < 64; j++) {
      if (num2[j]) {
        su += temp * num[j];
      }
      temp *= 2;
    }
    if (su != b[i]) {
      return 0;
    }
    if (b[i] + c[i] != s + n * a[i]) return 0;
  }
  return 1;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> b[i];
      sum += b[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> c[i];
      sum += c[i];
    }
    if (sum % (long long)n * 2) {
      cout << -1 << "\n";
      continue;
    }
    sum /= ((long long)n * 2);
    int flag = 0;
    for (int i = 0; i < n; i++) {
      if ((b[i] + c[i] - sum) % n) {
        flag = 1;
        break;
      }
      a[i] = (b[i] + c[i] - sum) / n;
    }
    if (flag == 1) {
      cout << "-1\n";
      continue;
    }
    if (!check()) {
      cout << "-1\n";
      continue;
    } else {
      for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
