Negative Weight Cycle#4821

Negative Weight Cycle

1 second
64 megabytes
Very hard

Given a directed graph, determine whether it contains a negative weight cycle, and if so, output it.

Input

The first line contains the integer (1 \leq N \leq 100) — the number of vertices in the graph. The next lines each contain integers — the adjacency matrix of the graph. The absolute value of any edge weight does not exceed . If there is no edge between two vertices, the corresponding entry in the matrix is .

Output

On the first line, print YES if a negative weight cycle exists, or NO otherwise. If a cycle is found, print on the second line the number of vertices in the cycle, and on the third line, print the vertices of the cycle in the order they are traversed.

Examples

Example 1

Loading
Loading