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