Road Network | 프로그래밍의 벗 PivotOJ
PivotOJ

Road Network

시간 제한: 1000ms메모리 제한: 2048MB출처: EIO 2023-24 sel2BOJ 33134

문제

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

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

예제

예제 1

입력
4
출력
NO
0 1

예제 2

입력
6
출력
YES
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.