Ivan, Petr, and Sidor were eating candies. Their last names are Ivanov, Petrov, and Sidorov. Ivanov ate 2 candies less than Ivan, Petrov ate 2 candies less than Petr, and Petr ate the most. What is the last name of each of them?
Ivanov ate less than Ivan, and Peter ate more than everyone, so Peter is not Ivanov. For the same reason, Peter is not Petrov, which means Peter's last name is Sidorov. Ivanov is not Ivan, so Ivanov's first name is Sidor. Therefore, Petrov's first name is Ivan.

## Task