How are the three types of rocks(sedimentary, igneous and metamorphic) formed?