Consider a sequence [a 1, a 2, ... , a n ]. Define its prefix product sequence . Now given n , find a permutation of [1, 2, ..., n], such that its prefix product sequence is a permutation of [0, 1, ..., n - 1].
输入描述:
The only input line contains an integer n (1 ≤ n ≤ 105).
输出描述:
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 ai. 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.
示例1
输出
YES<br />1<br />4<br />3<br />6<br />5<br />2<br />7<br />NO<br />
备注:
For the second sample, there are no valid sequences.
加载中...