The Universe is mainly made up of hydrogen and helium atoms. The other elements represent less than 1% of the matter. And yet these rare elements are necessary to form solid matter, ices and rocks, which are the constituents of the terrestrial planets.
The relative proportion of the elements is the reflection of the processes that have formed these atoms.
On this figure, note that the scale is logarithmic, there are 3 intervals between H (hydrogen) and O (oxygen), i.e. there are =1000 times as much H than O.
The lightest atoms, hydrogen (H), helium (He), and a little bit of lithium (Li) and beryllium (Be), were created during the Big Bang. Within the stars, the first thermonuclear reactions formed carbon (C), nitrogen (N), oxygen (O) and fluorine (F).
The life of the stars is made up of several steps, and the creation of each atom is associated with one of these steps.