Valence-states of boron, carbon, nitrogen and oxygen