a, b, c = int(input()), int(input()), int(input()) names = ["Петя", "Вася", "Толя"] s_d = [a, b, c] cnt = 1 for speed in sorted([a, b, c], reverse=True): print(f"{cnt}. {names[s_d.index(speed)]}") cnt += 1