Hydrogen atoms were most numerous and most reactive in primitive atmosphere. First hydrogen atoms combined with all oxygen atoms to form water and leaving no free oxygen. Hydrogen atoms also combined with nitrogen, forming ammonia (NH3). So water and ammonia were probably the first compound molecules of primitive earth. Later methane, water and NH3 join to form amino acids which gets converted into proteins while hydrogen bases, sugars and phosphates combine to form nucleic acids.