#include <bits/stdc++.h>
using namespace std;
long long n, sum, a[200005], b[200005], c[200005], cnt[30];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> b[i];
  for (long long i = 1; i <= n; i++) cin >> c[i];
  for (long long i = 1; i <= n; i++) sum += b[i] + c[i];
  if (sum % (n * 2)) {
    cout << -1;
    return 0;
  }
  sum /= n * 2;
  for (long long i = 1; i <= n; i++) {
    if ((b[i] + c[i] - sum) % n) {
      cout << -1;
      return 0;
    }
    a[i] = (b[i] + c[i] - sum) / n;
  }
  for (long long j = 0; j <= 29; j++) {
    for (long long i = 1; i <= n; i++) cnt[j] += ((a[i] & (1 << j)) > 0);
  }
  for (long long i = 1; i <= n; i++) {
    long long r = 0;
    for (long long j = 0; j <= 29; j++) {
      if (a[i] & (1 << j))
        r += n * (1 << j);
      else
        r += cnt[j] * (1 << j);
    }
    if (c[i] != r) {
      cout << -1;
      return 0;
    }
  }
  for (long long i = 1; i <= n; i++) cout << a[i] << " ";
}
