Recently Polycarpus has learned the "bitwise AND" operation (which is also called "AND") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.
For that Polycarpus came to school a little earlier and wrote on the board a sequence of non-negative integers a1, a2, ..., an.
He also wrote a square matrix b of size n × n. The element of matrix b that
sits in the i-th row in the j-th column (we'll denote it as bij)
- the "bitwise AND" of numbers ai and aj (that
is, bij = ai & aj), if i ≠ j;
- -1, if i = j.
Having written out matrix b, Polycarpus got very happy and wiped a off the blackboard. But
the thing is, the teacher will want this sequence to check whether Polycarpus' calculations were correct. Polycarus urgently needs to restore the removed sequence of integers, or else he won't prove that he can count correctly.
Help Polycarpus, given matrix b, restore the sequence of numbers a1, a2, ..., an,
that he has removed from the board. Polycarpus doesn't like large numbers, so any number in the restored sequence mustn't exceed 109.