Codeforces Round 332 (Div. 2) |
---|

Finished |

implementation

*1500

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Spongebob and Joke

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputWhile Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence *a*_{1}, *a*_{2}, ..., *a*_{m} of length *m*, consisting of integers from 1 to *n*, not necessarily distinct. Then he picked some sequence *f*_{1}, *f*_{2}, ..., *f*_{n} of length *n* and for each number *a*_{i} got number *b*_{i} = *f*_{ai}. To finish the prank he erased the initial sequence *a*_{i}.

It's hard to express how sad Patrick was when he returned home from shopping! We will just say that Spongebob immediately got really sorry about what he has done and he is now trying to restore the original sequence. Help him do this or determine that this is impossible.

Input

The first line of the input contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 100 000) — the lengths of sequences *f*_{i} and *b*_{i} respectively.

The second line contains *n* integers, determining sequence *f*_{1}, *f*_{2}, ..., *f*_{n} (1 ≤ *f*_{i} ≤ *n*).

The last line contains *m* integers, determining sequence *b*_{1}, *b*_{2}, ..., *b*_{m} (1 ≤ *b*_{i} ≤ *n*).

Output

Print "Possible" if there is exactly one sequence *a*_{i}, such that *b*_{i} = *f*_{ai} for all *i* from 1 to *m*. Then print *m* integers *a*_{1}, *a*_{2}, ..., *a*_{m}.

If there are multiple suitable sequences *a*_{i}, print "Ambiguity".

If Spongebob has made a mistake in his calculations and no suitable sequence *a*_{i} exists, print "Impossible".

Examples

Input

3 3

3 2 1

1 2 3

Output

Possible

3 2 1

Input

3 3

1 1 1

1 1 1

Output

Ambiguity

Input

3 3

1 2 1

3 3 3

Output

Impossible

Note

In the first sample 3 is replaced by 1 and vice versa, while 2 never changes. The answer exists and is unique.

In the second sample all numbers are replaced by 1, so it is impossible to unambiguously restore the original sequence.

In the third sample *f*_{i} ≠ 3 for all *i*, so no sequence *a*_{i} transforms into such *b*_{i} and we can say for sure that Spongebob has made a mistake.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/30/2023 14:22:34 (l1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|