{"raw_statement":[{"iden":"statement","content":"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.\n\nThree strings of the same length n (1 ≤ n ≤ 200000) are given in the input. They consist of lowercase Latin letters.\n\nIf such a situation is not possible, output «_Impossible_».\n\nIf there are several spells satisfying the conditions, output «_Ambiguous_».\n\nFinally, if the forgotten spell is the only one possible, output it.\n\n"},{"iden":"input","content":"Three strings of the same length n (1 ≤ n ≤ 200000) are given in the input. They consist of lowercase Latin letters."},{"iden":"output","content":"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."},{"iden":"examples","content":"InputaabacadaaOutputaaaInputabcacaabcOutputAmbiguousInputabcdefghijklmnoOutputImpossible"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ with $ 1 \\leq n \\leq 200000 $.  \nLet $ s_1, s_2, s_3 \\in \\Sigma^n $ be three input strings over the alphabet $ \\Sigma = \\{a, b, \\dots, z\\} $.  \nLet $ x \\in \\Sigma^n $ be the target spell.\n\n**Constraints**  \nFor each $ i \\in \\{1,2,3\\} $, the Hamming distance satisfies $ d_H(s_i, x) \\leq 1 $.\n\n**Objective**  \nDetermine the set $ X = \\{ x \\in \\Sigma^n \\mid \\forall i \\in \\{1,2,3\\},\\ d_H(s_i, x) \\leq 1 \\} $:  \n- If $ |X| = 0 $, output \"Impossible\".  \n- If $ |X| > 1 $, output \"Ambiguous\".  \n- If $ |X| = 1 $, output the unique $ x \\in X $.","simple_statement":"Three people each remember a string of length n. Each person made at most one typo. Find the original string they all tried to remember. If no such string exists, output \"Impossible\". If multiple exist, output \"Ambiguous\". If exactly one exists, output it.","has_page_source":false}