hi my dear friend,
changes of state involve a solid melting, a liquid freezing, a liquid boiling or a gas condensing. when steam, which is gaseous water, condenses, heat is released. likewise when liquid water freezes, heat is given off. in fact heat must be continually removed from the freezing water or the freezing process will stop.
the exosphere is the least dense because it is the farthest away from earth