Anthanaa asas tha QWARTY kaabaard.
Anthonio (also known as Anthanaa) thinks it is funny to replace all vowels with the letter 'a'. When he types, he consistently replaces any 'a', 'e', 'i', 'o', 'u' with an 'a'. Any 'y' is either kept or replaced by an 'a' arbitrarily with no consistency.
You are given a dictionary of words of lowercase letters and a list of messages by Anthonio with only lowercase letters and spaces. Each word in the dictionary contains the letter 'y' at most four times.
Determine for each message whether the message is possibly consistent with the dictionary, and if so, whether it is ambiguous. If the message is consistent with the dictionary and not ambiguous, reconstruct Anthonio's intended message.
The input consists of:
For each message, if there is a unique message consisting of words in the dictionary that Anthonio could have meant, output "possible" followed by Anthonio's intended message. Otherwise, if there are multiple messages that Anthonio could have meant, output "ambiguous". Otherwise, output "impossible".
7 3 hello world i have a yoyo lmao 2 halla warld 4 a hava a yaya 2 aaay lmaa
possible hello world ambiguous impossible
3 3 aayayy ayyaay yyyyaa 1 ayaaay 1 ayaaya 1 aayaay
possible ayyaay impossible ambiguous