Klepyn V.A.

Buratino laid out 2016 matches on the table and offered Harlequin and Pierrot to play a game, taking matches from the table in turns: Harlequin can take either 5 or 26 matches on his turn, while Pierrot can take either 9 or 23. Without waiting for the game to start, Buratino left, and when he returned, the game was already over. Two matches were left on the table, and the one who couldn't make the next move lost. After thinking it over, Buratino figured out who moved first and who won. Figure it out yourself!
Note that when divided by 7, the number of matches taken by Harlequin gives a remainder of 5, while the number of matches taken by Pierrot gives a remainder of 2. The number 2016 is divisible by 7, so after each move of the player who moved second, the number of remaining matches will also be divisible by 7.

Since there are two matches left on the table, the last move must have taken a number of matches that gives a remainder of 5 when divided by 7. Therefore, the last move was made by Harlequin, and he won.

All moves except the last one can be paired, in which the total number of matches taken is divisible by 7, so the first move was also made by Harlequin.

## Answer

Harlequin moved first, and he won.

## Problem