#P15057. [UOI 2023 II Stage] Roads of Potokolandiya
[UOI 2023 II Stage] Roads of Potokolandiya
Description
In Potokoland, there are cities and two-way roads. The -th road connects cities and (if , then ).
For example, if , the roads will be , , , , and .
Determine if it is possible to travel from any city to any other city using the roads. If not, find a pair of cities that are not connected.
Input Format
The first line contains one integer ().
Output Format
Output if it is possible to travel from any city to any other city.
Otherwise, output on the first line. On the second line, output any two cities and (; ) such that it is impossible to travel from to using the roads.
5
NO
1 5
4
YES
7
NO
1 7
8
YES
京公网安备 11011102002149号