CF245D Restoring Table
Description
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 $ a_{1},a_{2},...,a_{n} $ . 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 $ b_{ij} $ ) equals:
- the "bitwise AND" of numbers $ a_{i} $ and $ a_{j} $ (that is, $ b_{ij}=a_{i} & a_{j} $ ), 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 $ a_{1},a_{2},...,a_{n} $ , that he has removed from the board. Polycarpus doesn't like large numbers, so any number in the restored sequence mustn't exceed $ 10^{9} $ .
Input Format
The first line contains a single integer $ n $ $ (1
Output Format
Print $ n $ non-negative integers $ a_{1},a_{2},...,a_{n} $ $ (0
Explanation/Hint
If you do not know what is the "bitwise AND" operation please read: http://en.wikipedia.org/wiki/Bitwise\_operation.