When a solid changes into a liquid, it absorbs heat equal to the latent heat of fusion. When a liquid changes into a solid, it loses heat equal to the latent heat of solidification.
When a liquid changes into a gas, it absorbs heat equal to the latent heat of vaporisation. When a gas condenses into a liquid, it loses heat equal to the latent heat of condensation.