When heat is applied to a material, its change in state typically goes from solid to liquid to gas. There are some exceptions where the material will go directly from a solid to a gas.
When a material is cooled, its change in state typically goes from gas to liquid to solid. There are some exceptions where the material will go directly from a gas to a solid.