Longest Path
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
There is a directed graph with vertices and edges. The vertices are numbered , and for each , the -th directed edge goes from vertex to vertex .
does not contain directed cycles.
Find the length of the longest directed path in . Here, the length of a directed path is the number of edges in it.
Input
The first line contains two integers: number of vertices and number of edges . Each of the next lines contains two integer that describe the edge of the graph.
Output
Print the length of the longest directed path in .
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 161
Acceptance rate 45%