350. XOR-omania
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard
Professor Vasechkin had a notebook with an outstanding set of non-negative integers
A1,
A2,...,
An. Somehow the most remarkable fact that made this set so outstanding appeared to be the impossibility to find such a subset of two or more elements, that XOR of elements in the subset would equal to zero. One day the professor managed to create a new set of integers
B1,
B2,...,
Bn(n-1)/2 through applying the XOR operations to all pairs of elements of
A set. The set
B was not written in any particular order. Unfortunately due to his natural absent-mindedness professor lost the
A set and now he is very confused but still obliged to ask you of a considerable favor. Please restore the set in accordance with the remaining
B set.
Input
The first line describes
M — the amount of numbers in
B set (1 ≤
M ≤ 100,
M =
N x (
N - 1) / 2 for some number
N). The second line describes
M numbers —
B1,
B2,...,
BM (0 ≤
Bi ≤ 2
31 - 1).
Output
Print the
A set in one line through a blank. All elements of
A should be from 0 to 2
31 - 1 inclusively. If there are several solutions of the problem, you can choose any of them. It is guaranteed that there exists at least one
A set that satisfies the condition.
Example(s)
sample input | sample output |
6
30 19 66 13 92 81
|
94 64 77 28
|