Consider a sequence [a_1, a_2, ... , a_{n}]. Define its prefix product sequence $[ a_{1} \operatorname{mod} n,(a_{1} a_{2}) \operatorname{mod} n, \cdots,(a_{1} a_{2} \cdots a_{n}) \operatorname{mod} n ]$.
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.
-----Examples-----
Input
7
Output
YES
1
4
3
6
5
2
7
Input
6
Output
NO
-----Note-----
For the second sample, there are no valid sequences.
import math
import sys
input = sys.stdin.readline
n = int(input())
def isPrime(n):
    for i in range(2, n):
        if n % i == 0:
            return False
    return True
if isPrime(n):
    print('YES')
    print('\n'.join(list(map(str, [1] + [i * pow(i - 1, n - 2, n) % n for i in range(2, n)] + [n]))[:n]))
elif n == 4:
    print('YES')
    print('\n'.join(map(str, [1, 3, 2, 4])))
else:
    print('NO')

import math
import sys
input = sys.stdin.readline
n = int(input())
def isPrime(n):
    for i in range(2, n):
        if n % i == 0:
            return False
    return True
if isPrime(n):
    print('YES')
    print('\n'.join(list(map(str, [1] + [i * pow(i - 1, n - 2, n) % n for i in range(2, n)] + [n]))[:n]))
elif n == 4:
    print('YES')
    print('\n'.join(map(str, [1, 3, 2, 4])))
else:
    print('NO')
