The zoo offered discounted admission for school groups: every fifth student gets a free ticket. Mr. Teacher of 6.A calculated that if he bought tickets for the children in his class, he would save on four tickets and pay 1995 CZK. Mrs. Teacher of 6.B suggested that he buy tickets for the children of both classes at once, and thus they would pay 4410 CZK.

How many children from 6.A and how many children from 6.B went to the zoo? (The price of a ticket in CZK is an integer.)

(Hint. How many tickets should be requested so that exactly four of them are free?)


Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
If when buying tickets for children from 6.A, thanks to the mentioned discount, 4 tickets were saved, there must have been at least $4 \cdot 5=20$, but fewer than $5 \cdot 5=25$ children from this class. With a number of children from 20 to 24, 4 fewer tickets, i.e., 16 to 20, would always have to be paid. The amount paid is divisible by 19, but not by $16,17,18$ or 20 (see prime factorization $1995=3 \cdot 5 \cdot 7 \cdot 19$). For children from 6.A, 19 tickets would thus need to be paid, and each would cost $1995: 19=3 \cdot 5 \cdot 7=105$ Kč. The number of children from 6.A was 4 more, i.e., $19+4=23$.

When buying tickets for children from both classes together, 4410 Kč would be paid, i.e., the number of tickets paid would be $4410: 105=42$. As part of the discount, each set of 4 paid tickets was supplemented with one free ticket, so with 42 paid tickets $(10 \cdot 4+2)$, they would receive $52(10 \cdot 5+2)$. The number of children from 6.B was $52-23=29$.

23 children from 6.A and 29 children from 6.B went to the zoo.