5. Vova has 19 math grades in his journal, all twos and threes, and the first four grades are twos. It turned out that among the quartets of consecutive grades, all 16 possible combinations of four twos and threes are present. What are Vova's last four grades?
5. Vova has 19 math grades in his journal, all twos and threes, and the first four grades are twos. It turned out that among the quartets of consecutive grades, all 16 possible combinations of four twos and threes are present. What are Vova's last four grades?

ANSWER. 3222.

SOLUTION. Note that there are exactly 16 quartets of consecutive grades in a string of 19 grades, meaning each combination appears exactly once. After the first four twos, there must be a three, otherwise the combination of four twos would appear twice. Therefore, after the combination 3222, neither 2 nor 3 can follow, as in both cases, a combination that has already appeared would reappear. Thus, the combination 3222 must be at the end of the string.