#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int M = 31;
long long n, a[N], b[N], c[N];
long long A[M];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  long long sumb = 0, sumc = 0;
  for (int i = 0; i < n; i++) cin >> b[i], sumb += b[i];
  for (int i = 0; i < n; i++) cin >> c[i], sumc += c[i];
  long long suma = (sumb + sumc) / (2 * n);
  for (int i = 0; i < n; i++) {
    a[i] = (b[i] + c[i] - suma) / n;
    if (a[i] < 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] & (1 << i)) A[i]++;
    }
  }
  for (int i = 0; i < n; i++) {
    long long curb = 0, curc = 0, bs = 1;
    for (int j = 0; j < M; j++) {
      long long b_bit = (a[i] & (1 << j)) ? A[j] : 0;
      long long c_bit = (a[i] & (1 << j)) ? n : A[j];
      curb += b_bit * bs;
      curc += c_bit * bs;
      bs <<= 1;
    }
    if (curb != b[i] || curc != c[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
