ECOO AT GRAMERCY 1999

The N Musketeers

(from "Polish Olympiads - VI")

INPUT FILE: musk.in
OUTPUT FILE: musk.out

A number of drunk misketeers have managed to (once again) get themselves in trouble by insulting all the other musketeers. They decide to stand in a circle and draw straws - the person to draw the shortest will duel with his right-hand neighbour. The winner stays in the circle while the loser, being dead and all, is removed from the circle. This process continues until only one musketeer is left standing - he is declared the overall winner. Note that the winner depends strongly on the order in which te musketeers battle. For instance, consider what happens if musketeer A can beat B, B can beat C and C can beat A: if A and B fight first C wins. If B and C fight first, A wins.

Given which musketeers can beat which (in matrix form) and a total number N of musketeers determine the numbers of those who can win.

INPUT
The first line contains N, the number of musketeers. 0 < N <= 99999.
On the following N lines is a matrix in the form
A1,1 A1,2 A1,3 ... A1,N
A2,1 A2,2 A2,3 ... A2,N
...
AN,1 AN,2 AN,3 ... AN,N
where Ai,j = 1 (0) means musketeer can (cannot) beat musketeer j. Note that Ai,j = 1 - Aj,i. By convention Ai,i = 1.

OUTPUT
Output the numbers of the musketters, separated by spaxces, for whom it is possible to win the match.

Sample Input File

4
1 1 1 1
0 1 0 1
0 1 1 0
0 0 1 1
3
1 0 1
1 1 0
0 1 1

Output for Sample Input

1
1 2 3
Downloader failed! Response object 006~ASP 0159~Buffering Off~Buffering must be on.