Problem 4.4. In the cafeteria queue, there are five schoolchildren: Anya, Borya, Vera, Gena, and Denis.

- Borya stands at the beginning of the queue.
- Vera stands next to Anya, but not next to Gena.
- Among Anya, Borya, and Gena, no two stand next to each other.

Who stands next to Denis?
Answer: Anya and Gena.

Solution. Let's number the places in the queue from 1 to 5: place №1 - the place at the beginning of the queue, place №5 - at the end of the queue.

From the first condition, we understand that Borya is standing at place №1, and from the third condition, it becomes clear that Anya and Gena are standing at places №3 and №5.

- Place №1 - Borya
- Place №2 - ?
- Place №3 - Anya or Gena
- Place №4 -
- Place №5 - Anya or Gena

From the second condition, it follows that Vера cannot stand at place №4 (otherwise, both Anya and Gena would be standing next to her). Therefore, she must be standing at place №2, and next to her (at place №3) stands Anya. Then, place №4 can only be occupied by Denis.

- Place №1 - Borya
- Place №2 - Vера
- Place №3 - Anya
- Place №4 - Denis
- Place №5 - Gena