#include <bits/stdc++.h>
using namespace std;
const int MAX = 200000, MAX_BIT = 31;
int A[MAX], B[MAX], C[MAX];
long long D[MAX];
int B2[MAX], C2[MAX];
int BK[MAX][MAX_BIT], CK[MAX][MAX_BIT];
int K[MAX_BIT];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", B + i);
  for (int i = 0; i < n; i++) scanf("%d", C + i);
  for (int i = 0; i < n; i++) D[i] = B[i] + C[i];
  memset(B2, 0, sizeof(B2));
  memset(C2, 0, sizeof(C2));
  memset(K, 0, sizeof(K));
  long long sumA = 0;
  for (int i = 0; i < n; i++) sumA += D[i];
  sumA /= 2 * n;
  for (int i = 0; i < n; i++) A[i] = (D[i] - sumA) / n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < MAX_BIT; j++) {
      if (A[i] & (1 << j)) K[j] += 1;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < MAX_BIT; j++) {
      int a = A[i] & (1 << j);
      if (a >= 1) a = 1;
      BK[i][j] = a == 0 ? 0 : K[j];
      CK[i][j] = a == 0 ? K[j] : n;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < MAX_BIT; j++) {
      B2[i] += BK[i][j] * (1 << j);
      C2[i] += CK[i][j] * (1 << j);
    }
  }
  for (int i = 0; i < n; i++) {
    if (B[i] != B2[i] || C[i] != C2[i]) {
      puts("-1");
      return;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", A[i]);
  }
  puts("");
}
int main() {
  solve();
  return 0;
}
