Solution (source code)

= Solution

Neglecting exhaust flight time, no <momentum> is stored in transit and
$$
(m_A+M-q)v_A+(m_B+q)v_B=0.
$$
Since the velocities have opposite signs, equal nonzero <speeds> imply equality of the instantaneous <masses>. For $m_B=2m_A$ and $M=5m_A$, this occurs at $6m_A-q=2m_A+q$, or $q=2m_A$. Therefore
$$
\boxed{v_s=u_0\ln\frac{6m_A}{4m_A}=u_0\ln\frac32.}
$$
The common-speed event occurs after $40\%$ of A's original fuel has been transferred, rather than when either rocket has its final <mass>. At this event the rearward exhaust still overtakes B: $v_A-u_0=-0.5945u_0<v_B=-0.4055u_0$. Thus the interception restriction in <8/b> does not invalidate this event even though extending complete ballistic capture over the much later burn would need separate checking.