When it comes to scary teeth, piranhas’ bite is among the most fearsome. Their razor-sharp teeth strip prey’s flesh with the ease of a butcher’s knife.

In a process that avoids dulling, the fish lose all their teeth on one side of their mouth at once, with a fresh set growing in five days later. Months later, the same thing happens on the other side of the jaw. That trait was how the carnivorous fish adapted to a diet of scales, fins and flesh, or so scientists thought.

Yet it turns out the fierce fish share this toothy trait with their plant-eating cousins, the pacu, suggesting that this tooth replacement strategy evolved earlier in the herbivorous ancestors of piranhas and pacus, scientists report in the September Evolution and Development.

That’s perhaps not so surprising, says Matthew Kolmann, a biologist at George Washington University in Washington, D.C. Eating hard seeds and tough stems can damage fish teeth, he says. Cycling through sets of teeth, instead of replacing teeth one at a time, may help the freshwater fish more evenly distribute the wear and tear from chewing.

Kolmann and his colleagues took micro CT scans of 93 pacu and piranha museum specimens spanning 40 species. Pacus have a double row of teeth along both the upper and lower jaw, while piranhas sport a single row, like humans. The images revealed well-developed teeth embedded in the jaw parallel to teeth already in use on one side of the mouth. These mature teeth form sawlike blades that lock together as a unit, ready to erupt and replace a lost row. A microscopic look at jaw tissue also showed tiny tooth buds beginning to develop along the opposite jaw.

That means the fish are continuously developing new sets of teeth throughout out their lives. “That’s a hallmark of the whole clade,” Kolmann says, “be it species that eat meat or plants.”