시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB31242376.667%

문제

There are $N$ cities and $N$ two-way roads in Potokoland. The cities are numbered from $0$ to $N-1$. The roads are also numbered from $0$ to $N-1$. The road number $i$ connects cities $i$ and $(3 \cdot i + 7) \bmod N$, where $x \bmod N$ is the remainder from dividing $x$ by $N$.

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 $N$ ($1 \le N \le 10^6$), 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 $A$ and $B$ ($0 \le A, B \le N-1$; $A \ne B$) such that it is impossible to travel from $A$ to $B$ using the roads. If there are several possible answers, output any one of them.

서브태스크

번호배점제한
144

$N \le 1\,000$.

256

No additional constraints.

예제 입력 1

4

예제 출력 1

NO
0 1

The roads are $(0, 3)$, $(1, 2)$, $(2, 1)$, $(3, 0)$, as shown on the left in the figure below.

예제 입력 2

6

예제 출력 2

YES

The roads are $(0, 1)$, $(1, 4)$, $(2, 1)$, $(3, 4)$, $(4, 1)$, $(5, 4)$, as shown on the right in the figure above.

채점 및 기타 정보

  • 예제는 채점하지 않는다.