시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB126181419.178%

문제

An annual bicycle rally will soon begin in Byteburg. The bikers of Byteburg are natural long distance cyclists. Local representatives of motorcyclists, long feuding the cyclists, have decided to sabotage the event.

There are n intersections in Byteburg, connected with one way streets. Strangely enough, there are no cycles in the street network - if one can ride from intersection u to intersection v, then it is definitely impossible to get from v to u.

The rally's route will lead through Byteburg's streets. The motorcyclists plan to ride their blazing machines in the early morning of the rally day to one intersection and completely block it. The cyclists' association will then of course determine an alternative route but it could happen that this new route will be relatively short, and the cyclists will thus be unable to exhibit their remarkable endurance. Clearly, this is the motorcyclists' plan - they intend to block such an intersection that the longest route that does not pass through it is as short as possible.

입력

In the first line of the standard input, there are two integers, n  and m(2 ≤ n ≤ 500,000, 1 ≤ m ≤ 1,000,000), separated by a single space, that specify the number of intersections and streets in Byteburg. The intersections are numbered from 1 to n. The m lines that follow describe the street network: in the i-th of these lines, there are two integers, ai, bi(1 ≤ ai,bi ≤ n, ai≠bi), separated by a single space, that signify that there is a one way street from the intersection no. ai to the one no. bi.

출력

The first and only line of the standard output should contain two integers separated by a single space. The first of these should be the number of the intersection that the motorcyclists should block, and the second - the maximum number of streets that the cyclists can then ride along in their rally. If there are many solutions, your program can choose one of them arbitrarily.

예제 입력 1

6 5
1 3
1 4
3 6
3 4
4 5

예제 출력 1

1 2

출처

Olympiad > Polish Olympiad in Informatics > POI 2013/2014 > Stage 2 4번

  • 스페셜 저지를 만든 사람: khsoo01