eolymp
bolt
Try our new interface for solving problems
Problems

A Famous King`s Trip

A Famous King`s Trip

Mr. B is the chief engineer in the Kingdom of FDUCS. Recently, the King asks Mr. B to develop a new plan of the road network in the country, since the existing one is so outdated that traffic jam often occurs. Unfortunately, Mr. B is now busy preparing for the ICPC World Finals. Therefore, He asks his friends Mr. G and Mr. M to help him finish that work. When Mr. B gets the solution from his friends, he realizes some problems: Mr. B forgot to specify the budget plan to Mr. G and Mr. M, thus the new solution contains too many new roads which the government cannot afford. After a precise calculation, Mr. B finds that he only need to delete exactly two roads in term of the financial facts (Of course, Mr. B will not delete more than two roads because he wants people in his country to have a convenient traffic). Can Mr. B delete two roads arbitrarily? The answer is negative. The King would like to take a travel on the new road system to review Mr. B's work. However, the King is so busy that he does not want to take travel with redundancy. That is, the King wants Mr. B to design a road system so that he can travel from the palace (in one city), pass each road exactly once, and then return to the palace. Moreover, during his travelling, the king must visit each city at least once. Mr. B feels hard to satisfy the King’s demand by deleting two roads from the original design. As an ICPC candidate with unlimited potential, can you help him? \InputFile For each test case, the first line contains two integers, \textbf{n} and \textbf{m} (\textbf{1} ≤ \textbf{n}, \textbf{m} ≤ \textbf{200000}), indicating the number of cities in the Kingdom and the roads in Mr. B's original plan. Following this are \textbf{m} lines, each contains a pair of integers \textbf{a} and \textbf{b}, denoting a bidirectional road between city \textbf{a} and city \textbf{b} (\textbf{1} ≤ \textbf{a}, \textbf{b} ≤ \textbf{n} and \textbf{a != b}), the number of cities are counted from \textbf{1}. No two roads connect the same pair of cities. \OutputFile For each test case, if Mr. B can satisfy the King’s requirement, then output "\textbf{YES}" in the first line, otherwise output "\textbf{NO}" (quotes for clarifying). If the answer is "\textbf{YES}", output two integers \textbf{X} and \textbf{Y} (\textbf{X} < \textbf{Y}) in the following line, specifying the two roads that Mr. B should delete from the original design. \textbf{X} and \textbf{Y} are the indexes of roads in the input, counting from \textbf{1}. If there are more than one possible answer, output the one that makes the pair of (\textbf{X}, \textbf{Y}) lexicographically smallest.
Time limit 15 seconds
Memory limit 128 MiB
Input example #1
4 6
1 2
1 3
1 4
2 3
2 4
3 4
Output example #1
Case 1: YES
1 6
Source ACM ICPC Fudan Local Programming Contest 2012