#arc0212. [arc021_2]Your Numbers are XORed...

[arc021_2]Your Numbers are XORed...

题目描述

有两个序列 aabb

已知序列 bb 的构造方法:

  • 对于 1i<L1 \le i < L 的情况,bi=aixorai+1b_i = a_i \operatorname{xor} a_{i + 1},其中 xor\operatorname{xor} 表示异或;
  • bL=aLxora1b_L = a_L \operatorname{xor} a_1

给定序列 bb 的长度 LL ,以及序列 bb,求序列 aa,如果没有一个满足的序列 aa,请输出-1

如果你不知道什么是异或,请点这个链接

输入格式

第一行一个整数 LL

第二行到第 L+1L + 1 行,每行一个整数,代表 bib_i

输出格式

输出符合要求的 aa 数列,一行一个数,如果没有,输出-1

数据范围

对于 100%100\% 的数据:

  • 2L1052 \le L \le 10^5
  • 0bi<2310 \le b_i < 2^{31}