5. Around a round table, there are $n$ empty glasses ( $n \geqslant 3$ ). Petya and Vasya take turns (starting with Petya) to fill them with compote or lemonade. In one move, a player can fill one empty glass with either of the two drinks of their choice. A player wins if, after their move, there is a glass with lemonade that has both neighboring glasses filled with compote. If a player does not get an empty glass, they lose. For which $n$ will Petya win regardless of Vasya's actions?
Answer: for odd $n$.

Solution. Let $n$ be odd. Petya's winning strategy is as follows. He chooses the first glass arbitrarily. Suppose that Vasya's next move fills a glass that is $k$ positions away from the first, counting along the shortest arc. If Petya then has a winning move, he wins. Otherwise, Petya fills the same drink into the glass that is $k$ positions away from the first in the opposite direction. By symmetry, it is clear that Vasya will not have a winning move either. Due to the oddness of $n$, Petya will fill the last empty glass if he does not win prematurely. In any case, Vasya loses.

Now let $n$ be even. We will consider the glasses to be at the vertices of a regular $n$-gon. We will call a key triplet any three consecutive glasses such that filling one of them with the appropriate drink can result in a winning combination. Vasya's strategy is as follows: if Petya fills the next glass and no key triplet is formed, Vasya fills the same drink into the glass that is symmetric to Petya's glass relative to the center of the $n$-gon. Due to the evenness of $n$, Petya can only win prematurely. We will show that this will not happen. Suppose that after Vasya's move, a key triplet $T$ is formed, and no such triplets existed before. Then $T$ includes the last glass filled by Vasya. By construction, the glasses of the triplet $T^{\prime}$, which is symmetric to $T$ relative to the center of the $n$-gon, are filled in the same way as in $T$, but in reverse order. Thus, $T^{\prime}$ is also a key triplet. But it existed before Vasya's move, which is impossible.