#P9738. Lexicographical Word Game
Lexicographical Word Game
Lexicographical Word Game
Leona and Zoe have obtained a set of words and decided to play the following game:
They take turns saying a word. In every turn, the word must satisfy the following conditions:
- It is lexicographically greater than the previously spoken word, i.e. if the previous word is \(w\), then the new word \(v\) must satisfy \(v > w\).
- The first letter of \(v\) must be either the same as the first letter of \(w\) or the next letter in the alphabet. In other words, if \(w[0]=c\) then the first letter of \(v\) must belong to the set \(\{ c, \; \mathit{next}(c) \}\). Note that if \(c = 'z'\), then only 'z' is valid.
At the very beginning, Leona starts the game by choosing the lexicographically smallest word from the list. In each turn, the current player must choose the lexicographically smallest valid word that has not been used yet. If a player cannot find any valid word on their turn, they lose the game.
Your task is to determine who wins the game when both players play optimally using the above strategy.
inputFormat
The first line contains an integer \(n\) representing the number of words. The following \(n\) lines each contain a word consisting of lowercase English letters.
You can assume that the words are unique and can be used only once during the game.
outputFormat
Output a single line containing either Leona
or Zoe
, indicating the winner of the game.
sample
3
apple
art
bat
Leona