#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T SQR(T x) {
  return x * x;
}
template <typename T>
inline void UPDATE_MIN(T &x, T y) {
  if (y < x) {
    x = y;
  }
}
template <typename T>
inline void UPDATE_MAX(T &x, T y) {
  if (x < y) {
    x = y;
  }
}
template <typename T>
inline int ARGMAX(T cont) {
  return max_element(cont.begin(), cont.end()) - cont.begin();
}
template <typename T>
inline int ARGMIN(T cont) {
  return min_element(cont.begin(), cont.end()) - cont.begin();
}
template <typename T>
inline int hamming(T x) {
  return __builtin_popcountll((long long)x);
}
int hamming(int x) { return __builtin_popcount(x); }
int hamming(long x) { return __builtin_popcountl(x); }
int hamming(long long x) { return __builtin_popcountll(x); }
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (__typeof(n - 1) i = (0), __tmpvar__end89 = (n - 1); i < __tmpvar__end89;
       i++)
    s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
template <class T>
inline string TOSTR(const T &x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
inline void DIER(char *res, char *dbg = NULL) {
  fprintf(stderr, "[!] die reason %s\n", dbg);
  puts(res);
  exit(0);
}
inline void PR(void) {}
inline void PR(int x) { printf("%d", x); }
inline void PR(long long x) { printf("%lld", x); }
inline void PR(size_t x) { printf("%llu", (unsigned long long)x); }
inline void PR(const char *s) { printf("%s", s); }
inline void PR(double f) { printf("%.10f", f); }
inline void PR(long double f) { printf("%.10f", (double)f); }
template <typename T>
inline void PR(vector<T> &vec) {
  auto sz = vec.size();
  for (auto x : vec) {
    PR(x);
    (--sz) ? putc(0x20, stdout) : 0;
  }
}
template <typename T>
inline void PRS(T x) {
  PR(x);
  putc(0x20, stdout);
}
template <typename T>
inline void PRN(T x) {
  PR(x);
  putc(0x0a, stdout);
}
void PRN(void) { putc(0x0a, stdout); }
struct pairhash {
  template <typename T, typename U>
  std::size_t operator()(const std::pair<T, U> &x) const {
    return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
  }
};
const int MOD = 1000 * 1000 * 1000 + 7;
const double PI = 3.1415926535897932384626433832795l;
template <typename T>
inline T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
inline void addto(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline void subto(int &a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  if (a >= MOD) a -= MOD;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  if (a >= MOD) a -= MOD;
  return a;
}
inline void multo(int &a, int b) { a = (long long)a * b % MOD; }
inline int mul(int a, int b) { return (long long)a * b % MOD; }
inline int mulmod(int a, int b, int mod) { return (long long)a * b % mod; }
inline int powmod(int a, int e, int mod) {
  int x;
  for (x = 1; e > 0; e >>= 1) {
    if (e & 1) x = mulmod(x, a, mod);
    a = mulmod(a, a, mod);
  }
  return x;
}
inline int invmod_prime(int a, int mod) { return powmod(a, mod - 2, mod); }
inline long long invmod_LL(long long p) {
  long long q = p;
  for (long long a = p * p; a != 1; a *= a) q *= a;
  return q;
}
int N, M, K, L, E, Q;
long long B[200123] = {};
long long C[200123] = {};
long long D[200123] = {};
long long A[200123] = {};
long long B2[200123] = {};
long long C2[200123] = {};
void die(char *res, char *dbg = NULL) {
  fprintf(stderr, "[!] die reason %s\n", dbg);
  puts(res);
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &N);
  for (__typeof(N) i = (0), __tmpvar__end236 = (N); i < __tmpvar__end236; i++)
    scanf("%lld", &B[i]);
  for (__typeof(N) i = (0), __tmpvar__end237 = (N); i < __tmpvar__end237; i++)
    scanf("%lld", &C[i]);
  for (__typeof(N) i = (0), __tmpvar__end238 = (N); i < __tmpvar__end238; i++)
    D[i] = B[i] + C[i];
  long long asum = 0;
  for (__typeof(N) i = (0), __tmpvar__end240 = (N); i < __tmpvar__end240; i++)
    asum += D[i];
  if (asum % (2 * N)) DIER("-1", "asum wrong");
  asum /= 2 * N;
  for (__typeof(N) i = (0), __tmpvar__end243 = (N); i < __tmpvar__end243; i++) {
    long long res = D[i] - asum;
    if (res % N) DIER("-1", "a[i] wrong");
    A[i] = res / N;
  }
  for (__typeof(31) e = (0), __tmpvar__end248 = (31); e < __tmpvar__end248;
       e++) {
    long long num1 = 0;
    for (__typeof(N) i = (0), __tmpvar__end250 = (N); i < __tmpvar__end250; i++)
      num1 += !!(A[i] & (1ll << e));
    for (__typeof(N) i = (0), __tmpvar__end251 = (N); i < __tmpvar__end251;
         i++) {
      long long ai = !!(A[i] & (1ll << e));
      if (ai) {
        B2[i] += (1ll << e) * num1;
        C2[i] += (1ll << e) * N;
      } else {
        C2[i] += (1ll << e) * num1;
      }
    }
  }
  for (__typeof(N) i = (0), __tmpvar__end261 = (N); i < __tmpvar__end261; i++) {
    if (B2[i] != B[i]) DIER("-1", "B2 wrong");
    if (C2[i] != C[i]) DIER("-1", "B2 wrong");
  }
  for (__typeof(N) i = (0), __tmpvar__end265 = (N); i < __tmpvar__end265; i++)
    PRS(A[i]);
  PRN();
  return 0;
}

### Prompt

In CPP, your task is to solve the following problem:

Anton goes to school, his favorite lessons are arraystudying. He usually solves all the tasks pretty fast, but this time the teacher gave him a complicated one: given two arrays b and c of length n, find array a, such that:

<image>

where a and b means bitwise AND, while a or b means bitwise OR.

Usually Anton is good in arraystudying, but this problem is too hard, so Anton asks you to help.

Input

The first line of the input contains a single integers n (1 ≤ n ≤ 200 000) — the size of arrays b and c.

The second line contains n integers bi (0 ≤ bi ≤ 109) — elements of the array b.

Third line contains n integers ci (0 ≤ ci ≤ 109) — elements of the array c.

Output

If there is no solution, print  - 1.

Otherwise, the only line of the output should contain n non-negative integers ai — elements of the array a. If there are multiple possible solutions, you may print any of them.

Examples

Input

4
6 8 4 4
16 22 10 10


Output

3 5 1 1 


Input

5
8 25 14 7 16
19 6 9 4 25


Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T SQR(T x) {
  return x * x;
}
template <typename T>
inline void UPDATE_MIN(T &x, T y) {
  if (y < x) {
    x = y;
  }
}
template <typename T>
inline void UPDATE_MAX(T &x, T y) {
  if (x < y) {
    x = y;
  }
}
template <typename T>
inline int ARGMAX(T cont) {
  return max_element(cont.begin(), cont.end()) - cont.begin();
}
template <typename T>
inline int ARGMIN(T cont) {
  return min_element(cont.begin(), cont.end()) - cont.begin();
}
template <typename T>
inline int hamming(T x) {
  return __builtin_popcountll((long long)x);
}
int hamming(int x) { return __builtin_popcount(x); }
int hamming(long x) { return __builtin_popcountl(x); }
int hamming(long long x) { return __builtin_popcountll(x); }
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (__typeof(n - 1) i = (0), __tmpvar__end89 = (n - 1); i < __tmpvar__end89;
       i++)
    s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
template <class T>
inline string TOSTR(const T &x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
inline void DIER(char *res, char *dbg = NULL) {
  fprintf(stderr, "[!] die reason %s\n", dbg);
  puts(res);
  exit(0);
}
inline void PR(void) {}
inline void PR(int x) { printf("%d", x); }
inline void PR(long long x) { printf("%lld", x); }
inline void PR(size_t x) { printf("%llu", (unsigned long long)x); }
inline void PR(const char *s) { printf("%s", s); }
inline void PR(double f) { printf("%.10f", f); }
inline void PR(long double f) { printf("%.10f", (double)f); }
template <typename T>
inline void PR(vector<T> &vec) {
  auto sz = vec.size();
  for (auto x : vec) {
    PR(x);
    (--sz) ? putc(0x20, stdout) : 0;
  }
}
template <typename T>
inline void PRS(T x) {
  PR(x);
  putc(0x20, stdout);
}
template <typename T>
inline void PRN(T x) {
  PR(x);
  putc(0x0a, stdout);
}
void PRN(void) { putc(0x0a, stdout); }
struct pairhash {
  template <typename T, typename U>
  std::size_t operator()(const std::pair<T, U> &x) const {
    return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
  }
};
const int MOD = 1000 * 1000 * 1000 + 7;
const double PI = 3.1415926535897932384626433832795l;
template <typename T>
inline T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
inline void addto(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline void subto(int &a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  if (a >= MOD) a -= MOD;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  if (a >= MOD) a -= MOD;
  return a;
}
inline void multo(int &a, int b) { a = (long long)a * b % MOD; }
inline int mul(int a, int b) { return (long long)a * b % MOD; }
inline int mulmod(int a, int b, int mod) { return (long long)a * b % mod; }
inline int powmod(int a, int e, int mod) {
  int x;
  for (x = 1; e > 0; e >>= 1) {
    if (e & 1) x = mulmod(x, a, mod);
    a = mulmod(a, a, mod);
  }
  return x;
}
inline int invmod_prime(int a, int mod) { return powmod(a, mod - 2, mod); }
inline long long invmod_LL(long long p) {
  long long q = p;
  for (long long a = p * p; a != 1; a *= a) q *= a;
  return q;
}
int N, M, K, L, E, Q;
long long B[200123] = {};
long long C[200123] = {};
long long D[200123] = {};
long long A[200123] = {};
long long B2[200123] = {};
long long C2[200123] = {};
void die(char *res, char *dbg = NULL) {
  fprintf(stderr, "[!] die reason %s\n", dbg);
  puts(res);
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &N);
  for (__typeof(N) i = (0), __tmpvar__end236 = (N); i < __tmpvar__end236; i++)
    scanf("%lld", &B[i]);
  for (__typeof(N) i = (0), __tmpvar__end237 = (N); i < __tmpvar__end237; i++)
    scanf("%lld", &C[i]);
  for (__typeof(N) i = (0), __tmpvar__end238 = (N); i < __tmpvar__end238; i++)
    D[i] = B[i] + C[i];
  long long asum = 0;
  for (__typeof(N) i = (0), __tmpvar__end240 = (N); i < __tmpvar__end240; i++)
    asum += D[i];
  if (asum % (2 * N)) DIER("-1", "asum wrong");
  asum /= 2 * N;
  for (__typeof(N) i = (0), __tmpvar__end243 = (N); i < __tmpvar__end243; i++) {
    long long res = D[i] - asum;
    if (res % N) DIER("-1", "a[i] wrong");
    A[i] = res / N;
  }
  for (__typeof(31) e = (0), __tmpvar__end248 = (31); e < __tmpvar__end248;
       e++) {
    long long num1 = 0;
    for (__typeof(N) i = (0), __tmpvar__end250 = (N); i < __tmpvar__end250; i++)
      num1 += !!(A[i] & (1ll << e));
    for (__typeof(N) i = (0), __tmpvar__end251 = (N); i < __tmpvar__end251;
         i++) {
      long long ai = !!(A[i] & (1ll << e));
      if (ai) {
        B2[i] += (1ll << e) * num1;
        C2[i] += (1ll << e) * N;
      } else {
        C2[i] += (1ll << e) * num1;
      }
    }
  }
  for (__typeof(N) i = (0), __tmpvar__end261 = (N); i < __tmpvar__end261; i++) {
    if (B2[i] != B[i]) DIER("-1", "B2 wrong");
    if (C2[i] != C[i]) DIER("-1", "B2 wrong");
  }
  for (__typeof(N) i = (0), __tmpvar__end265 = (N); i < __tmpvar__end265; i++)
    PRS(A[i]);
  PRN();
  return 0;
}

```