#icpc2013summerwarmingUph. [icpc2013summer_warmingUp_h]Shuffling Machine
[icpc2013summer_warmingUp_h]Shuffling Machine
Description
KM bought a new card shuffling machine.
According to his hypothesis, everytime you setup cards and push the switch, it shuffles the cards in a totally same way. More precisely, there exists a sequence of integers , , ..., such that
- the 1st card in the resulting order is always the -th card in the initial order,
- the 2nd card in the resulting order is always the -th card in the initial order,
- ..., and so on.
He wanted to know this sequence, so he setup cards in the ascending order: , , ..., . However, he accidentally pushed the switch times, and the resulting order of the cards was , , ..., .
But KM says that you can guess , , ..., from , , ..., . Can you do that?
Input
The first line of the input file contains the integers () and (), separated by a space.
The second line of the input file contains N different integers which denotes , , ..., () in this order, separated by a space.
Output
If KM's hypothesis seems to be wrong, just print Impossible
. If there are several possibilities, print Ambiguous
. Otherwise, print integers which denotes , , ..., in this order, separated by a space.
Sample Input
3 2
3 1 2
Sample Output
2 3 1
Sample Input
3 2
1 3 2
Sample Output
Impossible
Sample Input
4 2
2 1 4 3
Sample Output
Ambiguous