n = int(input())
student = []
score = set()
for i in range(n):
    s = input()
    x = float(input())
    score.add(x)
    student.append([s, x])
score = list(score)
name = []
for st in student:
    if st[1] == score[1]:
        name.append(st[0])
print(name[1])

7cff165f45872a377c56511bb4750adb3ffc51a4
<mask token>

<mask token>
for i in range(n):
    s = input()
    x = float(input())
    score.add(x)
    student.append([s, x])
<mask token>
for st in student:
    if st[1] == score[1]:
        name.append(st[0])
print(name[1])

n = int(input())
student = []
score = set()
for i in range(n):
    s = input()
    x = float(input())
    score.add(x)
    student.append([s, x])
score = list(score)
name = []
for st in student:
    if st[1] == score[1]:
        name.append(st[0])
print(name[1])
