#include <bits/stdc++.h>
using namespace std;
long long a[200001], b[200001], c[200001], d[200001], s, n, cnt[200001];
int bit(int a, int j) { return (a & (1 << j)) >> j; }
int checkb() {
  int mb = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 29; ++j) {
      int x = bit(a[i], j), y = bit(b[i], j);
      if (x != 0) mb += cnt[j];
      if (y != mb % 2) return 0;
      mb /= 2;
    }
  }
  return 1;
}
int checkc() {
  int mc = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 29; ++j) {
      int x = bit(a[i], j), y = bit(c[i], j);
      if (x != 1)
        mc += cnt[j];
      else
        mc += n;
      if (y != mc % 2) return 0;
      mc /= 2;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  scanf("%I64d", &n);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &b[i]);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &c[i]);
  for (int i = 1; i <= n; ++i) d[i] = b[i] + c[i], s += d[i];
  s = s / (2 * n);
  for (int i = 1; i <= n; ++i) a[i] = (d[i] - s) / n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 29; ++j) {
      int x = bit(a[i], j);
      if (x) cnt[j]++;
    }
  }
  if (checkb() && checkc())
    for (int i = 1; i <= n; ++i) printf("%I64d ", a[i]);
  else
    printf("-1");
  return 0;
}
