When does a substance releases heat?? (it's about changing state of matter)