Problem list
Log in
#coci00632 · COCI 2022/2023 Contest 2

Prijateljice

Unrated 1.0 s 512 MB

One summer night in Krk, Leona and Zoe went for a walk. On their winding path, they found a pile of words! Excited by that, they quickly started collecting them: Leona collected $n$ words, and Zoe $m$ words. After admiring them for a while, they decided to play the following game: In one move a player says a word from her pile. The player chooses the word in such a way that the following conditions are met: the word is lexicographically greater than the previous word, and it begins with the same letter as the previous word or with the first letter of the English alphabet after it. If a player can’t make a move, she loses. They alternate turns, and Leona plays first by saying her lexicographically smallest word. If Leona and Zoe play optimally, determine who wins. Note: The word $A$ $is$ lexicographically smaller than the word $B$ $if$ the word $A$ $is$ $a$ prefix $of$ the word $B$ $or$ $if$ $in$ the first position $in$ which the words $A$ and $B$ differ the letter $in$ $A$ $at$ that position comes before the letter $in$ $B$ $at$ that position.

Input

The first line contains integers $n$ and $m$ ($1 \le n$, $m \le 10^{5}$), the number of Leona’s words, and the number of Zoe’s words. The following $n$ lines contain Leona’s words. The following $m$ lines contain Zoe’s words. Words from the input contain only lowercase letters of the English alphabet, all words are mutually distinct, their total length is at most $10^{6}$, and Leona’s and Zoe’s words are lexicographically sorted.

Output

Output Leona or Zoe, the name of the winner.

Example 1

Input
2 1
avokado
dabar
brazil
Output
Zoe

Example 2

Input
3 3
ananas
atlas
banana
albatros
cikla
nogomet
Output
Leona

Example 3

Input
2 2
hrvatska
zastava
bijeli
galeb
Output
Leona

Clarification of the first example: Leona starts with the word avokado, then Zoe continues with her only word brazil. Leona can’t make any move so she loses.

Source
COCI 2022/2023 Contest 2
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code