What role did gravity play in the formation of the planets?

A. The gravity of the Sun was too weak to hold it together, and large pieces of the Sun broke off to form the planets.
B. The gravitational forces inside small asteroids pushed outward, causing the asteroids to swell to the size of planets.
C. Planet-sized bodies passing by the solar system were pulled in by Earth's gravity and fell into orbit around the Sun.
CD. Gravitational forces brought together several moon-sized bodies, called planetesimals,
to form larger bodies that became planets.

D. Gravitational forces brought together several moon-sized bodies, called planetesimals, to form larger bodies that became planets.