There are a number of tackling this. One of the simples utilises the conservation of energy and of linear momentum.

The two spheres start at a seperation of 12R, and end at a seperation of 4R,

so the change in potential energy of the system is equal to the work required

to take the spheres from a seperation of 4R to one of 12R:

DE=int(r=4R:12R) G _1 m_2/r^2 dr = G m_1 m_2/(6R)

So as the spheres start from rest this is equal to the sum of their KE's

when they hit:

G m_1 m_2/(6R) = (m_1 v_1^2 + m_2 v_2^2)/2.

The conservation of momentum gives:

m_1 v_1 = -m_2 v_2.

Solve these two equations to find v_1 and v_2.

RonL