#include <bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int b[200005];
long long sum;
int res[200005];
int ge[35];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sum += a[i];
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), sum += b[i];
  if (n == 1 && a[1] != b[1]) {
    puts("-1");
    return 0;
  }
  if (sum % (n * 2) != 0) {
    puts("-1");
    return 0;
  }
  sum = sum / n;
  sum = sum / 2;
  for (int i = 1; i <= n; i++) {
    int tmp = a[i] + b[i] - sum;
    if (tmp % n || tmp < 0) {
      puts("-1");
      return 0;
    }
    tmp = tmp / n;
    res[i] = tmp;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 30; j++) {
      if (res[i] & (1 << j)) ge[j]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    long long nowa = 0, nowb = 0;
    for (int j = 0; j < 30; j++) {
      if (res[i] & (1 << j)) {
        nowa += ge[j] * (1 << j);
        nowb += 1ll * n * (1 << j);
      } else {
        nowb += ge[j] * (1 << j);
      }
    }
    if (nowa != a[i] || nowb != b[i]) {
      puts("-1");
      return 0;
    }
  }
  for (int i = 1; i < n; i++) printf("%d ", res[i]);
  printf("%d\n", res[n]);
  return 0;
}
