Andrianampoinimerinandriantsimitoviaminandriampanjaka —
usually abbreviated as Andrianampoinimerina — ruled the Kingdom
of Imerina1 from 1787 until his death. His reign was marked by the
reunification of Imerina following 77 years of civil war, and the
subsequent expansion of his kingdom into neighboring territories, thereby
initiating the unification of Madagascar under Merina rule.
Andrianampoinimerina is a cultural hero and holds near mythic status among
the Merina people. He is considered one of the greatest military and
political leaders in the history of Madagascar.
Andrianampoinimerina was born Ramboasalamarazaka (short form: Ramboasalama) around 1745 in Ikaloy, in central Madagascar, to Princess Ranavalonandriambelomasina, daughter of King Andriambelomasina of Imerina (1730-1770), and her husband Andriamiaramanjaka, an andriana (noble) of the Zafimamy royal family in the independent kingdom of Alahamadintany to the north of Imerina. His mother's brother Andrianjafy was named Andriambelomasina's successor and was king of Imerina Avaradrano, the northern quadrant of the former Kingdom of Imerina, from 1770 to 1787.
Andrianampoinimerina took power upon deposing his uncle, King Andrianjafy, who had ruled over Imerina Avarandrano (Northern Imerina). Prior to Andrianampoinimerina's reign, Imerina Avarandrano had been locked in conflict with the three other neighboring provinces of the former kingdom of Imerina that had last been unified under King Andriamasinavalona a century before.
Andrianampoinimerina established his capital at the fortified town of Ambohimanga, a site of great spiritual, cultural and political significance that was designated a UNESCO World Heritage Site in 2001. The king's original royal lodgings can still be visited at Ambohimanga today. From this position, he progressively extended his domain first over all Imerina and then over the greater Highlands, absorbing the Betsileo, Sihanaka, Bezanozano and Bara territories. Having reigned for 23 years at the time of his death, Andrianampoinimerina had successfully reunited Imerina and vastly expanded the Merina kingdom, with the intent to ultimately unify all of Madagascar under Merina rule. His son and heir, Radama I, continued the conquests Andrianampoinimerina had begun, and over the next two decades largely achieved his father's vision.
As a child we often played a game were each participant in turn had to say a word that starts and ends with the same letter. In addition, from the second word onward, that word had to start (and thus also end) with the next letter in the alphabet, with the letter A following the letter Z. The game was lost if someone said a word that did not meet these two rules, or if he or she took too long to come up with the next word. The game became more fun when trying to come up with funny or extremely long words. As such, the name of the king in the above story was a good fit for the game. That is, if you managed to pronounce it properly.
The first line contains a number $$n \in \mathbb{N}_0$$. This is followed by a sequence of $$n$$ words, each on a separate line.
The output must contain the first word in the given sequence that does not meet the rules of the game: first and last letter have to be the same, and first letter of the word must be the next letter in the alphabet of the first letter of the previous word. Of course, the second rule only holds from the second word onward, and we agree that the letter A follows the letter Z. In addition, when checking the two rules, no distinction should be made between uppercase and lowercase letters. If all words in the given sequence meet the rules of the game, the output must contain the sentence no mistake.
Input:
7
Alaska
baobab
Cadillac
daughterhood
Enigma
flameproof
governmentalizing
Output:
Enigma
Input:
8
Xerox
yoctohenry
zettaherz
Andrianampoinimerina
breadcrumb
Dortmund
ethylenediaminetetraacetate
featherleaf
Output:
Dortmund
Input:
6
kinnikinnick
lepidopterological
mesembryanthemum
Napoleon
obbligato
postmastership
Output:
no mistake