The speed of sound depends on the elasticity of the medium. As solids have the highest elasticity it travels faster in solids. Elasticity is less for liquids and least for gases hence its speed decreases in liquids and it is the slowest in gases. Therefore, for a given temperature, sound travels fastest in iron.