P30020 [洛谷] [COCI2022-2023#2] Friends
普及+
题目描述

Problem Description

Leona and Zoe have been given some words. They plan to play a game using these words:

In each round, they take turns saying a word. This word must meet the following criteria:

  • It must be lexicographically larger than the previous word.
  • The starting letter must be the same as the previous word's starting letter or exactly one position after it in the alphabet.

Leona starts first and will choose the lexicographically smallest word. The person who cannot say a word loses.

Both players will use optimal strategies, meaning they will choose the lexicographically smallest word that meets the conditions.

They want to know who will win.

Input Format

The first line contains two integers \( n \) and \( m \) (\( 1 \le n, m \le 10^5 \)).

The next \( n \) lines each contain a string representing a word that Leona has.

The following \( m \) lines each contain a string representing a word that Zoe has.

All input words are lowercase and unique. The total length of all words does not exceed \( 10^6 \), and they are sorted lexicographically.

Output Format

Output a single line containing either "Leona" or "Zoe", indicating the winner.

Sample Input and Output

Sample Input #1

2 1
avokado
dabar
brazil

Sample Output #1

Zoe

Sample Input #2

3 3
ananas
atlas
banana
albatros
cikla
nogomet

Sample Output #2

Leona

Sample Input #3

2 2
hrvatska
zastava
bijeli
galeb

Sample Output #3

Leona

Notes/Hints

Subtask Points Special Conditions
1 20 \( n, m \le 100 \), each word's length does not exceed 10
2 30 \( n, m \le 1000 \)
3 60 None

This problem is worth a total of 110 points.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 avokado dabar brazil
样例输出
Zoe