We know the upward motion, u2 = u2 -2gh
Or h = u^2+v^2\over2g
But at the highest point, v = 0
Therefore, h = u^2\over2g
For first ball, h1 = u_1^2\over2g
and for second ball, h2 = u_2^2\over2g
Thus, {h_1\over h_2}={{u_1^2\over2g}\over {u_2^2\over2g} }={u_1^2\over u_2^2}
Or, h1 :h2 = u_1^2 : u_2^2