Is there a cycle?#496

Is there a cycle?

1 second
128 megabytes
Easy (≈1000)

The directed graph is given. Determine, does it contain a cycle.

Input

First line contains number of vertices n~(n \le 50). Each of the next lines contains numbers, each of them is either or . -th number in the -th line equals to if and only if there exist an edge from -th vertex to -th. It is guaranteed that diagonal of the matrix contains zeros.

Output

Print if there is no cycle in the graph and if cycle exists.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading