#include <bits/stdc++.h>
using namespace std;
int n, a[200200], b[200200], c[200200], s[200200], cnt[30];
long long sum;
bool check() {
  for (int i = 1; i <= n; ++i) {
    long long sb = 0, sc = 0;
    for (int j = 0; j < 30; ++j)
      if (a[i] & (1 << j))
        sc += (1ll << j) * n, sb += (1ll << j) * cnt[j];
      else
        sc += (1ll << j) * cnt[j];
    if (sb != b[i] || sc != c[i]) return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &c[i]);
  for (int i = 1; i <= n; ++i) s[i] = b[i] + c[i], sum += s[i];
  sum /= n * 2;
  for (int i = 1; i <= n; ++i) a[i] = (s[i] - sum) / n;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 30; ++j) cnt[j] += (a[i] >> j) & 1;
  if (!check())
    printf("-1");
  else
    for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
  return 0;
}
