how was the solar system formed