Rally

No attempts yetTime limit1sMemory limit256 MB

Problem

The annual bicycle rally in Byteburg starts soon. Byteburg's cyclists are natural long distance riders. The local motorcyclists, who have feuded with the cyclists for years, decided to sabotage the event.

Byteburg has nn intersections joined by one way streets. The street network has no cycles: if you can ride from intersection uu to intersection vv, then you can never get from vv back to uu.

The rally route runs along Byteburg's streets. Early in the morning of the rally day the motorcyclists will ride to one intersection and block it completely. The cyclists' association will then pick a new route, but the new route may be short, so the riders cannot show their endurance. That is what the motorcyclists want. They block the intersection that makes the longest route avoiding it as short as possible.

A route is a sequence of distinct intersections followed along the direction of the streets, and its length is the number of streets it uses. A route that stays at one intersection and uses no street has length 00.

Input

The first line contains two integers nn and mm separated by a single space (2n5000002 \le n \le 500\,000, 1m10000001 \le m \le 1\,000\,000), the number of intersections and the number of streets in Byteburg. The intersections are numbered from 11 to nn.

Each of the next mm lines describes one street. The ii-th of them contains two integers aia_i and bib_i separated by a single space (1ai,bin1 \le a_i, b_i \le n, aibia_i \ne b_i), meaning there is a one way street from intersection aia_i to intersection bib_i. The street network has no cycles.

Output

Print two integers separated by a single space. The first is the number of the intersection the motorcyclists should block. The second is the largest number of streets the cyclists can ride along after that intersection is blocked.

If several intersections reach the same smallest maximum, print the one with the smallest number.