#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
long long a[maxn], b[maxn], c[maxn];
bool check(long long n, long long sum) {
  for (int i = 1; i <= n; i++) {
    if (b[i] + c[i] != n * a[i] + sum) {
      return false;
    }
  }
  for (int i = 30; i >= 0; i--) {
    int num = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] & (1 << i)) {
        num++;
      }
    }
    for (int j = 1; j <= n; j++) {
      if (a[j] & (1 << i)) {
        c[j] -= (1 << i) * n;
        b[j] -= (1 << i) * num;
      } else {
        c[j] -= (1 << i) * num;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (c[i] || b[i]) return false;
  }
  return true;
}
int main() {
  srand(time(NULL));
  long long n;
  scanf("%lld", &n);
  long long sum1 = 0, sum2 = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
    sum1 += b[i];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
    sum2 += c[i];
  }
  long long sum = (sum1 + sum2) / 2 / n;
  for (int i = 1; i <= n; i++) {
    a[i] = ((b[i] + c[i]) - sum) / n;
  }
  if (check(n, sum)) {
    for (int i = 1; i <= n; i++) {
      printf("%lld ", a[i]);
    }
  } else {
    printf("-1\n");
  }
  return 0;
}
