#include <bits/stdc++.h>
using namespace std;
const int M = 200005;
long long a[M], b[M], c[M], S, n;
int ct[34];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]), S += b[i];
  for (int i = 1; i <= n; i++) scanf("%I64d", &c[i]), S += c[i];
  if (S % (2LL * n)) {
    cout << "-1" << endl;
    return 0;
  }
  S /= 2LL * n;
  for (int i = 1; i <= n; i++)
    if ((b[i] + c[i] - S) % n) {
      cout << "-1" << endl;
      return 0;
    } else
      a[i] = (b[i] + c[i] - S) / n;
  for (int j = 0; j < 34; j++)
    for (int i = 1; i <= n; i++) ct[j] += (a[i] >> j) & 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 34; j++) b[i] -= (a[i] & (1ll << j)) * ct[j];
    if (b[i] != 0) {
      cout << "-1" << endl;
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) printf("%I64d ", a[i]);
  return 0;
}
