Codeforces Round 278 (Div. 1)
C
Prefix Product Sequence
Codeforces
2300
原题
← BD →
翻译中…

Consider a sequence $[*a*_{1}, *a*_{2}, ... , *a*_{*n*}]$. Define its prefix product sequence image.

翻译中…

Now given $*n*$, find a permutation of $[1, 2, ..., *n*]$, such that its prefix product sequence is a permutation of $[0, 1, ..., *n* - 1]$.

翻译中…

Input

翻译中…

The only input line contains an integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$).

翻译中…

Output

翻译中…

In the first output line, print "YES" if such sequence exists, or print "NO" if no such sequence exists.

翻译中…

If any solution exists, you should output $*n*$ more lines. $*i*$-th line contains only an integer $*a*_{*i*}$. The elements of the sequence should be different positive integers no larger than $*n*$.

翻译中…

If there are multiple solutions, you are allowed to print any of them.

翻译中…

Note

翻译中…

For the second sample, there are no valid sequences.

翻译中…

样例

Input #1
7
Output #1
YES
1
4
3
6
5
2
7
InputCopy OutputCopy
Input #2
6
Output #2
NO
InputCopy OutputCopy
题目信息
题号
487C
时间限制
1 s
内存限制
256 MB
标签
构造
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。