Mesosaur
Mesosaurs ("middle lizards") were a group of small aquatic reptiles that lived during the early Permian period, roughly 299 to 270 million years ago. Mesosaurs were the first known aquatic reptiles, having apparently returned to an aquatic lifestyle from more terrestrial ancestors. It is uncertain which and how many terrestrial traits these ancestors displayed; recent research cannot establish with confidence if the first amniotes were fully terrestrial, or only amphibious. Most authors consider mesosaurs to have been aquatic, although adult animals may have been amphibious, rather than completely aquatic, as indicated by their moderate skeletal adaptations to a  semiaquatic lifestyle. Similarly, their affinities are uncertain; they may have been among the most basal sauropsids or among the most basal parareptiles (in the case of which parareptiles were basal sauropsids). Phylogeny. The phylogenetic position of mesosaurs has an important bearing on the definition of Reptilia. In one of the first major phylogenetic studies of amniotes (vertebrates laying eggs on land) Gauthier "et al." (1988) placed Mesosauridae in a group called Parareptilia. Parareptilia means "at the side of reptiles" and was placed outside the clade Reptilia, which was considered a crown group. As a crown group, Reptilia included the most  recent common ancestor of the then believed to be the two main lineages of living reptiles -anapsids (specifically turtles) and diapsids (all other living reptiles)- and all descendants of that common ancestor. This view of placing turtles outside of diapsids is now outdated and the majority of modern paleontologists believe that the Testudines (turtles and allies) are descended from diapsid reptiles that lost their temporal fenestrae. More recent morphological phylogenetic studies with this in mind placed turtles firmly within diapsids, and, more commonly, as a sister taxon to Archosauria (made up of crocodiles, dinosaurs -including birds- and allies). Furthermore, Anapsida  is rarely considered a valid clade in recent phylogenetic analyses. In this sense, Reptilia was a node-based taxon because the first reptilian common ancestor would have been a "node" on the phylogenetic tree. Under this phylogeny, many extinct forms traditionally regarded as reptiles including mesosaurs were excluded from the group because they were outside the node. The study of Laurin and Reisz (1995) was the second major phylogenetic analysis of amniotes. Like Gauthier "et al.", Laurin and Reisz used Reptilia as a crown group and placed mesosaurs outside the group. Their phylogeny differed in that the parareptiles of Gauthier  et al. were now regarded as close relatives of turtles, within crown group Reptilia. Laurin and Reisz adopted the name Sauropsida as a node-based taxon including the last common ancestor of mesosaurs and Reptilia. Traditionally, amniotes are divided into two groups: a mammal lineage called Synapsida and a reptile lineage called either Reptilia or Sauropsida. In fact, the study of Gauthier (1994) defined Sauropsida as all amniotes more closely related to reptiles than to mammals, which meant that Sauropsida was a stem-based taxon encompassing the entire reptilian lineage or reptilian "stem" of Amniota (Synapsida was the mammalian stem ). Under this phylogeny, the only group that prevents Sauropsida from being equivalent to Reptilia is mesosaurs. More recent phylogenetic analyses, such as that of Modesto (1999), support that of Gauthier "et al." (1988) by placing mesosaurs with parareptiles. However, these phylogenies follow Laurin and Reisz (1995) in placing Parareptilia within crown-group Reptilia, meaning that mesosaurs are once again members of Reptilia. Using Laurin and Reisz's node-based definition of Sauropsida as "The last common ancestor of mesosaurs, testudines and diapsids, and all its descendants", Sauropsida and Reptilia are equivalent groupings; mesosaurs and testudines are more closely related to  each other than either group is to diapsids, meaning that the clade containing testudines and diapsids (which would be crown-group Reptilia) must also contain mesosaurs. Since Reptilia was named earlier than Sauropsida, it is used most often in modern phylogenetic analyses. A 2017 phylogenetic analysis by Laurin (who had previously published the 1995 study) and Piñeiro recovered mesosaurs as a basal member of Sauropsida/Reptilia and no longer present within Parareptilia, with Parareptilia being redefined as including former members of Procolophonomorpha (found to be paraphyletic), Millerosauria, Pareiasauria, and Pantestudines, with the latter two being found to be sister groups  to one another. Parareptilia was also found to actually nest inside Diapsida as the sister group to Neodiapsida. In 2012 it was revealed that "Mesosaurus" has holes at the back of the skull called lower temporal fenestrae, a characteristic once thought to be present only in synapsids and diapsids. This confirmed the previous results of German paleontologist Friedrich von Huene, already published in 1941 The condition in the skull of "Mesosaurus" is most similar to that in synapsid skulls because both lack the upper temporal fenestrae of diapsids. Lower temporal fenestrae are so far known only in "Mesosaurus", but may  be present in all mesosaurs. The presence or absence of temporal fenestrae is an important consideration in the phylogeny of mesosaurs and other amniotes because the three major groups of amniotes -Synapsida, Diapsida, and Anapsida- have been named after the number of holes in their skull; Diapsida means "two arches" in reference to the two bars that close off the upper and lower fenestra, Synapsida means "fused arch" in reference to a single bar at the bottom of the skull closing a single fenestra, and Anapsida means "no arch" in reference to skulls that lack any bars or fenestrae. Mesosaurs  were traditionally classified as anapsids because they were thought to have lacked temporal fenestrae. However, the occurrence of fenestrae in amniotes has been recognized a highly variable feature within the group for many years prior to their discovery in "Mesosaurus"; many anapsids such as "Candelaria", "Bolosaurus", and lanthanosuchoids possess lower temporal fenestrae. The phylogenetic position of mesosaurs influences the current understanding of how amniotes evolved temporal fenestrae. If the phylogeny produced by Laurin and Reisz (1995) is correct in that mesosaurs are basal sauropsids, the lower temporal fenestra may be a primitive feature in amniotes, present in amniote's most  recent common ancestor. Synapsids would have retained their fenestrae, and so too would sauropsids except for turtles and most parareptiles. Another possibility under Laurin and Reisz's phylogeny is that lower temporal fenestrae evolved independently in mesosaurs, synapsids, diapsids, and some parareptiles, and that the lack of fenestrae is a primitive feature in amniotes. If instead mesosaurs are members of Parareptilia, the presence of temporal fenestrae is probably not a primitive feature in amniotes, and the lower temporal fenestrae in mesosaurs may be characteristic of a lineage of basal parareptiles that also includes fenestra-bearing lanthanosuchoids and "Bolosaurus". Biology. They  have long been thought to have been coastal forms that probably inhabited relatively shallow water, but recent research suggests that at least those from Uruguay inhabited a hypersaline environment, rather than a coastal marine environment. Recently described embryos show that pachyostosis of the ribs (which were thicker and denser than in terrestrial tetrapods) developed even before hatching, which suggests that mesosaurs were able to swim at birth, or shortly thereafter. They were apparently not very fast swimmers, with an optimal swimming speed estimated to have been between 0.15 and 0.86 m/s, but this must have been somewhat faster than  the speed of their main prey, the pygocephalomorph crustaceans. Their reproductive mode is somewhat uncertain because association between adults and possible embryos in utero suggests viviparity, as in many aquatic reptiles, but a potentially isolated egg has also been found. Recently, evidence of predation on both pygocephalomorph crustaceans and members of their own species has been established. It is thought that mesosaurs were in general adapted to hypersaline habitats. A study on the vertebral column torso and tail proportions of "Mesosaurus" suggests that, while juveniles may have been fully aquatic, adults might have spent some time on land; this is  further vindicated by the rarity of adult animals in aquatic settings and some faeces showing signs of drying fracture. However, how terrestrial they were is difficult to say, as this same study states that terrestrial foraging would have been difficult due to their speciations to an aquatic life.