Cometary origin of carbon and water on the terrestrial planets.