Answer:
F1 = G M1 m / x^2 gravitational force on test mass m due to M1
F2 = G M2 m / (R - x)^2 gravitational force on test mass m due to M2
M1 / x^2 = M2 / (R - x)^2
(R - x)^2 / x^2 = M2 / M1
(R - x) / x = (M2 / M1)^1/2 where x is distance from M1 and R is total distance between objects
Check: x = R / 2 then M1 = M2 as it should