you should write equation for this
if we put x as the number of students in the second class then the equation will be :

now you can find the value of x:

the number of students in the second class is 25
you can find the others, too
first class: 25+ 3=28
third class: 25+ 2=27
good luck