CF487C Prefix Product Sequence
Description
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\] $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
For the second sample, there are no valid sequences.