#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
unsigned long long Total;
unsigned long long Array[200001];
unsigned long long Brray[200001];
unsigned long long Crray[200001];
unsigned long long Count[101];
int main(void) {
  register unsigned long long i, j;
  cin >> Total;
  for (i = 1; i <= Total; i++) {
    cin >> Brray[i];
  }
  for (i = 1; i <= Total; i++) {
    cin >> Crray[i];
  }
  register unsigned long long Sum;
  Sum = 0;
  for (i = 1; i <= Total; i++) {
    Sum += Brray[i];
  }
  for (i = 1; i <= Total; i++) {
    Sum += Crray[i];
  }
  if (Sum % (Total * 2) != 0) {
    goto Impossible;
  }
  Sum /= (Total * 2);
  for (i = 1; i <= Total; i++) {
    Array[i] = Brray[i] + Crray[i] - Sum;
    if (Array[i] % Total != 0) {
      goto Impossible;
    }
    Array[i] /= Total;
    for (j = 1; j <= 63; j++) {
      if ((Array[i] & (unsigned long long)pow(2, j - 1)) != 0) {
        Count[j]++;
      }
    }
  }
  for (i = 1; i <= Total; i++) {
    register unsigned long long Temp;
    Temp = 0;
    for (j = 1; j <= 63; j++) {
      if ((Array[i] & (unsigned long long)pow(2, j - 1)) != 0) {
        Temp += Count[j] * (unsigned long long)pow(2, j - 1);
      }
    }
    if (Temp != Brray[i]) {
      goto Impossible;
    }
    Temp = Sum;
    for (j = 1; j <= 63; j++) {
      if ((Array[i] & (unsigned long long)pow(2, j - 1)) != 0) {
        Temp += (Total - Count[j]) * (unsigned long long)pow(2, j - 1);
      }
    }
    if (Temp != Crray[i]) {
      goto Impossible;
    }
  }
  for (i = 1; i <= Total; i++) {
    cout << Array[i] << ' ';
  }
  cout << endl;
  return 0;
Impossible:
  cout << -1 << endl;
  return 0;
}
