The first line contains a single integer, representing the number of players.
Then n lines follow. Each line contains an 01-stringof length n.
if and only if player i and player j are friends.
The input guarantees thatand
.
Output a single line with a 01-string res of length n.
if and only if the game will end immediately in the first turn if player i is selected as the first dragon.
Without loss of the generality, suppose the third player is selected as the first dragon. Then:
1. For the first player, if he/she chooses to attack, he/she will become the dragon of the second turn. However, according to the first sample, he/she will then be eliminated and will get only 1 point. Therefore, he/she will choose not to attack and thus he/she can get 10 points.
2. For the second player, for the same reason, he/she will choose not to attack, too.
Therefore, the game will end in the first turn.