Is there a cycle?#4004

Is there a cycle?

1 second
128 megabytes
Very easy

A directed graph is given. Determine whether it contains a cycle.

Input

The first line contains a single integer — the number of vertices n~(n \le 50).

Then follow lines, each containing integers — the adjacency matrix of the graph. Each number is either or . The -th number in the -th line is equal to if and only if there is an edge from vertex to vertex .

It is guaranteed that the main diagonal of the matrix contains only zeros.

Output

Print if the graph contains no cycles, and if there is at least one cycle.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading