7.7. Petya told Misha that in his class exactly two thirds of all the girls are blondes, exactly one seventh of the boys are blonds, and in total, a third of the class has light hair. Misha said: "You once told me that there are no more than 40 people in your class. 0 ! I know how many girls are in your class!" How many?
Answer: 12 girls

Solution. Let there be $x$ girls and $y$ boys in the class. From the problem statement, we have the following relationship:

$\frac{2}{3} x+\frac{1}{7} y=\frac{1}{3}(x+y)$,

which, after transformation, becomes $7 x=4 y$.

From the condition and the derived relationship, it follows that the number $x$ is divisible by 3 and 4, so it is divisible by 12. Let $x=12 n$, where $n$ is a natural number. From the derived equation, it follows that $y=21 n$.

Therefore, there are $x+y=12 n+21 n=33 n$ students in the class. According to the condition, this number is no more than 40, so $n=1$. In the class, there are $x=12 n=12$ girls.