Weak k-connectivity
Anya, as a future world champion in programming, commissioned a very responsible job. The Government of the N-region presents her plan for building roads between cities. Under the plan, all the roads one-way, but between the two cities may be more than one way, perhaps in different directions. Anya is necessary to calculate the smallest such k, that the plan it is weakly k-connected.
The government plan calls weakly k-connected if the following condition: for any two different cities you can drive from one to another, violating the rules of the road no more than k times. Violation of the rules - this passage from an existing road in the opposite direction. It is guaranteed that between any two cities can be reached, perhaps several times violated the rules.
Input
The first line of the input file are given two numbers, 2 ≤ n ≤ 300 и 1 ≤ m ≤ 10^5 - the number of cities and roads in the plan. The following m lines given by two numbers - numbers of cities, which begins and ends with the corresponding road.
Output
In the output file output minimum k, such that the input file plan is a weak k-connected.