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{25}{7}$ and $MD=\frac{10}{7}$. Similarly, a line passing through vertex $D$ and the center of the second circle intersects side $BC$ at point $N$. Here, $BN=\frac{3}{2}$ and $NC=\frac{9}{2}$.

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=5: 6 ;$ b) $A B=5, C D=6$.

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=5: 2$ and $B D: D C=B N: N C=1: 3$. Therefore, $A B: C D=\frac{5}{2} \cdot \frac{1}{3}=5: 6$.

b) Let the points of tangency of the circle inscribed in triangle $A B D$ with its sides $A B$, $A D, B D$ be $P, F, K$ respectively; the points of tangency of the circle inscribed in 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=5-y, A P=A F=5-y$, $C Q=B C-B Q=6-x, C E=C Q=6-x, A B=A P+P B=5+x-y, C D=6-x+y$.

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