A3. At the first school hour, the number of boys and girls in the class was in the ratio $3: 4$. When 4 more girls came to the class before the second school hour, and 4 boys left the class, the ratio became $2: 5$. How many more girls than boys were there in the class at the second school hour?
(A) 5
(B) 6
(C) 7
(D) 8
(E) 12
A3. Let's denote the number of boys in the class during the first school hour by $f$ and the number of girls by $d$. Then, $\frac{f}{d}=\frac{3}{4}$. During the second school hour, there are $f-4$ boys and $d+4$ girls in the class, so the ratio is $\frac{f-4}{d+4}=\frac{2}{5}$. From the first equation, we express $f=\frac{3}{4} d$ and substitute it into the second equation, to get

$$
\frac{\frac{3}{4} d-4}{d+4}=\frac{2}{5}
$$

We rearrange the equation to $\frac{7}{4} d=28$, so $d=16$ and $f=12$. During the second school hour, there are 8 boys and 20 girls in the class, which means there are 12 more girls than boys.