If you’ve ever had the pleasure of interacting with a seal at a zoo or aquatic center, the experience probably reminded you of a playful puppy. Well, there’s a biological explanation for your instinctual observation.

Dogs, seals, sea lions, and even bears are all in the same suborder of carnivorous mammals—caniformia.

In biology, all living things on the planet, from the microscopic water bear to megafauna like the blue whale, are organized into increasingly specific groups.

Domain: That’s planet earth. Whale, seals, and dogs are all certainly residents of this planet.

Kingdom: There are six biological kingdoms: Animalia (where dogs, whales, and seals are categorized), Plantae, Fungi, Protista, Archaea/Archaebacteria, and Bacteria/Eubacteria.

Phylum: Within the Animalia Kingdom, there are 34 phyla. This groups animals together based on key characteristics like the shape of their mouth, how they poop, and how they get around. Dogs, seals, and whales fall into the Chordate phyla with more than 65,000 other creatures that are capable of having nervous systems and tails among other common characteristics.

Class: These three creatures are within the Mammalia class. This consists of animals with backbones, hair, and those who nurse their young with milk. There are approximately 5,450 individual species within this biological class.

Order: Seals and dogs are still together among the 280 species within the Carnivora order of the Mammalia class. Most animals within this order have teeth and claws that allow them to catch and eat other critters. This is where seals start to differ from whales, who fall into the Cetartiodactyla order along with pigs, giraffes, cows, and buffalo.

There are two dominant Suborders within the Carnivora order: Feliformia, or cat-like animals, and Caniformia, or dog-like creatures, which of course includes dogs, but also seals, bears, raccoons, and badgers.

Family: There are nine families within the Caniformia suborder, and this is where, somewhere around 50 million years ago, dogs and seals were biologically separated from one another. Seals fall within the Pinnipedia clade (a sub-group of families) while dogs are in the Canidae family.

Pinniped is essentially Latin for “fin foot,” which is a curious, but very accurate way to describe seals and sea lions.

Whales began living in the water roughly around the same time that seals were separating from their peers in the Caniformia order, but, of course, they evolved from large hoofed animals rather than from dog-like creatures.

Genus: There are 13 genera of Canidae which break down into 35 specific species, the common dog is a member of the Canis genus. As for pinnipeds, there are 33 living species within the broader clade, but there are just two species within the Phoca genus.

Species: Domesticated dogs are formally called Canis familiaris while harbor seals are technically named Phoca vitulina.

So evolutionarily speaking, playful dogs and seals are something like third cousins—just 50 million years or so removed—while seals and whales are closer to 4th cousins.