#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int a[maxn], b[maxn], c[maxn], d[maxn], tempb, tempc;
int bits[maxn][31] = {}, bit[31] = {}, bb[maxn] = {}, cc[maxn] = {};
long long sum = 0;
bool check = true;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    d[i] = c[i] + b[i];
    sum += d[i];
  }
  sum /= 2 * n;
  for (int i = 0; i < n; i++) {
    a[i] = (d[i] - sum) / n;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] < 0) check = false;
  }
  if (check != false) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 31; j++) {
        bits[i][j] = (a[i] & (1ll << j) ? 1 : 0);
        bit[j] += bits[i][j];
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 31; j++) {
        tempb = (bits[i][j] ? bit[j] : 0);
        tempc = (bits[i][j] ? n : bit[j]);
        bb[i] += tempb << j;
        cc[i] += tempc << j;
      }
    }
    for (int i = 0; i < n; i++) {
      if (bb[i] != b[i] || cc[i] != c[i]) {
        check = false;
        break;
      }
    }
  }
  if (check == false) {
    cout << "-1";
  } else {
    for (int i = 0; i < n; i++) {
      cout << a[i] << ' ';
    }
  }
  cout << endl;
  return 0;
}
