239. Two cones have a common base and are located on opposite sides of it. The radius of the base is $r$, the height of one cone is $h$, and the other is $H (h \leqslant H)$. Find the greatest distance between two generatrices of these cones.
239. Let $A$ and $B$ be the vertices of the cones, $M$ and $N$ be two points on the circumferences of the bases, and $L$ be the point diametrically opposite to point $M\left(|A M|=\sqrt{r^{2}+H^{2}},|B M|=\sqrt{r^{2}+h^{2}}\right)$. Draw a plane through $M$ perpendicular to $A M$, and denote by $B_{1}, N_{1}$, and $L_{1}$ the projections of $B, N$, and $L$ onto this plane. The distance between $A M$ and $B N$ is equal to the distance between $M$ and $B_{1} N_{1}$ and cannot be greater than $\left|M B_{1}\right|$.

From the condition $h \leqslant H$, it follows that $\left|M B_{1}\right| \leqslant\left|M L_{1}\right|$, i.e., that point $B_{1}$ is inside or on the boundary of the projection of the base of the cones onto the drawn plane, and the distance between $M$ and $B_{1} N_{1}$ is equal to $M B_{1}$ if $M B_{1}$ and $B_{1} N_{1}$ are perpendicular.

Answer: $\frac{(h+H) r}{\sqrt{r^{2}+H^{2}}}$.