e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

Sources and sinks

Sources and sinks

The vertex of directed graph is called source if no edge comes into it, and sink if no edge comes out of it.

The directed graph is given with adjacent matrix. Find all its sources and sinks.

Input

The first line contains the number of vertices in a graph n (1n100), then the adjacent matrix is given - n lines with n numbers, each of them equals to 0 or 1.

Output

Print in the first line the number of sources in a graph, and then sources in increasing order. Print in the second line the information about sinks in the same format.

prb3986.gif

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
0 0 0 0 0
0 0 0 0 1
1 1 0 0 0
0 0 0 0 0
0 0 0 0 0
Output example #1
2 3 4
3 1 4 5