A three-phase chemical model of hot cores: The formation of glycine