#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200005;
int n, a[N], b[N], c[N], s[N], cnt[30];
bool check() {
  for (int i = 1; i <= n; i++) {
    ll bb = 0, cc = 0;
    for (int j = 0; j < 30; j++) {
      if (a[i] & (1ll << j))
        bb += (1ll << j) * cnt[j], cc += (1ll << j) * n;
      else
        cc += (1ll << j) * cnt[j];
    }
    if (bb != b[i] || cc != c[i]) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  ll sum = 0;
  for (int i = 1; i <= n; i++) s[i] = b[i] + c[i], sum += s[i];
  sum /= n * 2;
  for (int i = 1; i <= n; i++) {
    a[i] = (s[i] - sum) / n;
    for (int j = 0; j < 30; j++)
      if (a[i] & (1 << j)) ++cnt[j];
  }
  if (!check())
    cout << -1 << endl;
  else
    for (int i = 1; i <= n; i++) cout << a[i] << ' ';
  return 0;
}
