• + 0 comments
    if __name__ == '__main__':
        
        n = int(input())
    
    buf = []
    report = []
    
    for i in range(n):
        name = str(input())
        score = float(input())
        marks = [name,score]
        report.append(marks)
    
    for i in range(len(report)):
        buf.append(report[i][1])
    
    buf = set(buf)
    buf = list(buf)
    buf.sort()
    val = buf[1]
    report.sort()
    
    for i in range(len(report)):
        if report[i][1] == val:
            print(report[i][0])