I want to know the answer to the following question:
What states that the system doing work always loses some energy as waste heat?
All the background I'm provided with is that "While heat can always be fully converted into work in a reversible isothermal expansion of an ideal gas, for cyclic processes of practical interest in heat engines the second law of thermodynamics states that the system doing work always loses some energy as waste heat.". Is that enough to answer the question?