Recently a large StarCraft II league was held: a round-robin tournament with N players in which every player played against each other player exactly once. The results were recorded in an N×N table, but it is not obvious from the table which players are stronger. As the organizer, you decide to produce a reasonable ranking of the players.
Let x and y be two different players, and suppose x is ranked higher than y. The ordered pair (x,y) is reasonable if at least one of the following holds:
A ranking — an ordering of all players from highest to lowest — is reasonable if every pair (x,y) with x ranked higher than y is reasonable.
Given the results table, produce a reasonable ranking of the players.
The input consists of several test cases. Each test case begins with a line containing a single integer N (1≤N≤1,000), the number of players. The next N lines describe the win-loss table M: each is a string of length N consisting only of the characters '0' and '1', with no leading or trailing spaces. The j-th character of the i-th line, Mij, is 1 if player i beat player j and 0 otherwise. For every i=j, exactly one of Mij and Mji is 1 (there are no draws), and Mii=0 for all i. The input ends with a line containing N=0, which must not be processed.
For each test case, print a reasonable ranking of all the players on one line, from the highest-ranked player to the lowest, separated by single spaces. Since more than one reasonable ranking may exist, print the lexicographically smallest one (compare rankings as sequences of player numbers). If no reasonable ranking exists, print impossible (without quotes) instead.