Road Network
시간 제한1초메모리 제한2048 MB
각 도시 i를 (3i+7) mod N번 도시와 잇는 N개의 도로가 주어질 때 그래프의 연결 여부를 판정하고, 연결되지 않았다면 서로 갈 수 없는 두 도시를 출력한다.
문제
There are cities and two-way roads in Potokoland. The cities are numbered from to . The roads are also numbered from to . The road number connects cities and , where is the remainder from dividing by .
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.
입력
The first line contains (), the number of cities in Potokoland.
출력
Output the word 'YES' if it is possible to travel from any city to any other city.
Otherwise, output the word 'NO' 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. If there are several possible answers, output any one of them.