#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int a[maxn], b[maxn], c[maxn];
int k[32];
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", b + i);
    sum += b[i];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", c + i);
    sum += c[i];
  }
  sum /= 2 * n;
  for (int i = 1; i <= n; i++) {
    a[i] = (b[i] + c[i] - sum) / n;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 32; j++) {
      if (a[i] >> j & 1) k[j]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 32; j++) {
      if (a[i] >> j & 1) {
        b[i] -= (1 << j) * k[j];
        c[i] -= (1 << j) * n;
      } else {
        c[i] -= (1 << j) * k[j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] || c[i] || a[i] < 0) {
      puts("-1");
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
