405060: GYM101755 M Forgotten Spell

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Forgotten Spelltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Three mages are trying to remember a spell. Each of them believes the spell is some string of length n and it is known that each of the mages is mistaken in at most one letter. It is required to restore the forgotten spell.

Input

Three strings of the same length n (1 ≤ n ≤ 200000) are given in the input. They consist of lowercase Latin letters.

Output

If such a situation is not possible, output «Impossible».

If there are several spells satisfying the conditions, output «Ambiguous».

Finally, if the forgotten spell is the only one possible, output it.

ExamplesInput
aab
aca
daa
Output
aaa
Input
abc
aca
abc
Output
Ambiguous
Input
abcde
fghij
klmno
Output
Impossible

加入题单

上一题 下一题 算法标签: