Dissolved minerals in the ground water precipitate (crystallize) from water in the pore spaces forming mineral crusts on the sedimentary grains, gradually cementing the sediments, thus forming a rock.
Water - It has the highest specific heat and therefore is the substance that would heat up the slowest.