Let s1 be the distance travelled by the first stone.
Let s2 be the distance travelled by the second stone.
s1 = ut - ½gt²
s2 = u(t-T) - ½g(t-T)²
the stones collide when s1 = s2
ut - ½gt² = u(t-T) - ½g(t-T)²
ut - ½gt² = ut - uT - ½gt² + gtT - ½gT²
uT + ½gT² = gtT
t = (u+½gT)/g
==========
substituting for t into the eqn for s1,
s1 = u(u + ½gT)/g - ½g(u + ½gT)²/g²
s1 = {u² + ½guT - ½u² - ½guT - (1/8)g²T²}/g
s1 = {½u² - (1/8)g²T²}/g
s1 = (4u² - g²T²)/(8g)
================