A body A experiences perfectly elastic collision with stationary body B. if after collision the bodies fly apart in the opposite direction with equal speeds the mass ratio of a and b.

I applied conservation of linear momentum

$m_1u_1=m_2v-m_1v $ where v be there final velocity.

and then I used coservation of energy.

$m_1u_1^2 =v^2 (m_1+ m_2)$

but I am not able to take out the ratio