#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
long long N, a[maxn], b[maxn], c[maxn], cnt[40];
bool check() {
  for (int i = 1; i <= N; i++) {
    long long ckb = 0, ckc = 0;
    for (int j = 0; j <= 30; j++) {
      if ((a[i] >> j) & 1) {
        ckb += cnt[j] * (1LL << j);
        ckc += (1LL << j) * N;
      } else {
        ckc += cnt[j] * (1LL << j);
      }
    }
    if (ckb != b[i] || ckc != c[i]) return false;
  }
  return true;
}
int main() {
  scanf("%lld", &N);
  long long sumbc = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &b[i]);
    sumbc += b[i];
  }
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &c[i]);
    sumbc += c[i];
  }
  long long suma = sumbc / 2 / N;
  for (int i = 1; i <= N; i++) {
    a[i] = (b[i] + c[i] - suma) / N;
    for (int j = 0; j <= 30; j++) {
      cnt[j] += ((a[i] >> j) & 1);
    }
  }
  if (check()) {
    for (int i = 1; i <= N; i++) printf("%lld%c", a[i], i == N ? '\n' : ' ');
  } else
    printf("-1\n");
  return 0;
}
