Delivery of carbon, nitrogen, and sulfur to the silicate Earth by a giant impact