When the Sun sent out solar winds, it stripped the inner planets of their hydrogen and helium, creating four inner terrestrial planets. These gases went to the outer reaches of the solar system and eventually made up the Jovian planets.