Cycle#5178

Cycle

1 second
64 megabytes
Easy

Given a directed graph.

Determine whether it contains a cycle with a negative total weight. If such a cycle exists, output it.

Input

The first line contains the integer (1 \le n \le 250), the number of vertices in the graph. The following lines each contain integers, representing the adjacency matrix of the graph. The weight of each edge does not exceed in absolute value. If there is no edge between two vertices, the corresponding entry in the matrix is .

Vertices are numbered from to .

Output

On the first line, output YES if a negative weight cycle exists in the graph, or NO otherwise. If a negative cycle exists, on the second line, output the number of vertices in the cycle (including the repeated start/end vertex), and on the third line, output the indices of the vertices in the order they appear in the cycle.

Examples

Example 1

Loading
Loading