if __name__ == '__main__':
    l=[]
    for i in range(int(input())):
        name = input()
        score = float(input())
        l.append(name)
        l.append(score)
        l.sort(i)
    print(l(i-1))   
        
        
