n = int(eval(input()))

dictionary = {}

for i in range(n) :

    new_word = eval(input())

    if new_word in list(dictionary.keys()) :

        dictionary[new_word] += 1

    else :

        dictionary[new_word] = 1



max_val = max(dictionary.values())

keys_of_max_val = [key for key in dictionary if dictionary[key] == max_val]



keys_of_max_val.sort()



for word in keys_of_max_val :

    print(word)
n = int(eval(input()))

words = {}



for i in range(n) :

    new_word = eval(input())

    if new_word in list(words.keys()) :

        words[new_word] += 1

    else :

        words[new_word] = 1



mx_freq = max(words.values())

mx_words = [k for k, v in list(words.items()) if words[k] == mx_freq]



mx_words.sort()



for mx_word in mx_words :

    print(mx_word)
n = int(eval(input()))
dictionary = {}
for i in range(n):
    new_word = eval(input())
    if new_word in list(dictionary.keys()):
        dictionary[new_word] += 1
    else:
        dictionary[new_word] = 1
max_val = max(dictionary.values())
keys_of_max_val = [key for key in dictionary if dictionary[key] == max_val]
keys_of_max_val.sort()
for word in keys_of_max_val:
    print(word)

n = int(eval(input()))
words = {}
for i in range(n):
    new_word = eval(input())
    if new_word in list(words.keys()):
        words[new_word] += 1
    else:
        words[new_word] = 1
mx_freq = max(words.values())
mx_words = [k for k, v in list(words.items()) if words[k] == mx_freq]
mx_words.sort()
for mx_word in mx_words:
    print(mx_word)

-dictionary = {} +words = {} -    if new_word in list(dictionary.keys()): -        dictionary[new_word] += 1 +    if new_word in list(words.keys()): +        words[new_word] += 1 -        dictionary[new_word] = 1 -max_val = max(dictionary.values()) -keys_of_max_val = [key for key in dictionary if dictionary[key] == max_val] -keys_of_max_val.sort() -for word in keys_of_max_val: -    print(word) +        words[new_word] = 1 +mx_freq = max(words.values()) +mx_words = [k for k, v in list(words.items()) if words[k] == mx_freq] +mx_words.sort() +for mx_word in mx_words: +    print(mx_word)