#include <bits/stdc++.h>
using namespace std;
class Solution {
  int n;
  vector<long long> a, b, c;
  int cnt[30] = {0};

 public:
  void run() {
    cin >> n;
    a.resize(n), b.resize(n), c.resize(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    long long ALL = accumulate(a.begin(), a.end(), 0ll) +
                    accumulate(b.begin(), b.end(), 0ll);
    if (ALL % (2 * n)) cout << -1 << '\n', exit(0);
    long long S = ALL / (2 * n);
    for (int i = 0; i < n; ++i) {
      c[i] = (a[i] + b[i]) - S;
      if (c[i] % n) cout << -1 << '\n', exit(0);
      c[i] /= n;
      for (int j = 0; j < 30; ++j) cnt[j] += (c[i] >> j) & 1;
    }
    for (int i = 0; i < n; ++i) {
      long long cura = 0, curb = 0;
      for (int j = 0; j < 30; ++j) {
        cura += (1ll << j) * ((c[i] >> j) & 1 ? cnt[j] : 0);
        curb += (1ll << j) * ((c[i] >> j) & 1 ? n : cnt[j]);
      }
      if (cura != a[i] or curb != b[i]) cout << -1 << '\n', exit(0);
    }
    for (int i = 0; i < n; ++i) cout << c[i] << " \n"[i == n - 1];
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  Solution().run();
}
