Scientists have discovered the remains of an elephant-sized mammal relative that lived among the dinosaurs during the Triassic period.