The longest Path#11452

The longest Path

1 second
128 megabytes
Medium

Given a directed graph with vertices and edges. The vertices are numbered from to . For each i~(1 \le i \le m), a directed edge from vertex x_i to vertex y_i is given.

The graph contains no directed cycles.

Find the length of the longest directed path in . The length of a path is defined as the number of edges in that path.

Input

The first line contains two integers: the number of vertices n~(2 \le n \le 10^5) and the number of edges m~(1 \le m \le 10^5) of the graph. Each of the next lines contains two integers x_i, y_i~(1 \le x_i, y_i \le n), describing a directed edge from vertex x_i to vertex y_i.

Output

Print the length of the longest directed path in the graph .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading