5. In a convex quadrilateral $ABCD$, diagonal $BD$ is drawn, and a circle is inscribed in each of the resulting triangles $ABD$ and $BCD$. A line passing through vertex $B$ and the center of one of the circles intersects side $DA$ at point $M$. Here, $AM=\frac{8}{5}$ and $MD=\frac{12}{5}$. Similarly, a line passing through vertex $D$ and the center of the second circle intersects side $BC$ at point $N$. Here, $BN=\frac{30}{11}$ and $NC=\frac{25}{11}$.

a) Find the ratio $AB:CD$.

b) Find the lengths of sides $AB$ and $CD$, given that the circles are tangent to each other.
Answer: a) $A B: C D=4: 5, A B=4, C D=5$.

Solution. a) Since the bisector of a triangle divides its side proportionally to the other two sides, $A B: B D=A M: M D=2: 3$ and $B D: D C=B N: N C=6: 5$. Therefore, $A B: C D=\frac{2}{3} \cdot \frac{6}{5}=4: 5$.

b) Let the points of tangency of the incircle of triangle $A B D$ with its sides $A B$, $A D$, $B D$ be $P$, $F$, $K$ respectively; the points of tangency of the incircle of triangle $B C D$ with its sides $B C$, $C D$, $B D$ be $Q$, $E$, $K$ respectively (the point of tangency with side $B D$ is common by condition).

Let $B K=x, K D=y$. Using the equality of the segments of the tangent drawn from one point to a circle, we obtain the relations

$B Q=B P=B K=x, D F=D E=D K=y, A F=A D-D F=4-y, A P=A F=4-y$, $C Q=B C-B Q=5-x, C E=C Q=5-x, A B=A P+P B=4+x-y, C D=5-x+y$.

In part a), it was obtained that $A B: C D=4: 5$, from which $\frac{4+x-y}{5-x+y}=\frac{4}{5}, x=y$. Then $A B=4$, $C D=5$.