Transformed Sequence
Time limit1sMemory limit512 MB
Given each D_i, find the lexicographically smallest permutation T on a cycle of N points with circular distance D(i, T_i) for every i, or report No Answer.
Problem
For integers , a transformed sequence changes each to , where and . For all , the distance between and is . Given the distance for each , find a transformed sequence that satisfies these requirements. If several sequences satisfy them, output the lexicographically smallest one.
Note: For two transformed sequences and , is lexicographically smaller than if there exists a such that for and .
Input
The first line contains a single integer , the length of the sequence. The next line contains integers , where is the distance between and .
Output
If at least one transformed sequence exists, print one line with integers, the lexicographically smallest . Otherwise, print No Answer. Separate adjacent numbers with a single space, and do not leave a trailing space.