Principle of calorimetry: Total heat given by a hotter body equals the total heat received by a colder body.
Heat lost by the hotter body = Heat gained by the colder body
When a body at a higher temperature is brought in contact with another body at a lower temperature, then the heat flows from the body kept at a higher temperature to the body kept at a lower temperature.