QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 128 MB Total points: 100

#11300. Rally

統計

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.

Input Format

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, $a_{i}$, $b_{i}$($1 ≤ a_{i},b_{i} ≤ n$, $a_{i}≠b_{i}$), separated by a single space, that signify that there is a one way street from the intersection no. $a_{i}$ to the one no. $b_{i}$.

Output Format

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.

Example

Input

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

Output

1 2
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.