Scientists have found some of the earliest evidence for widespread tooth decay in humans.
It comes from the skeletal remains of Stone-Age hunter-gatherers who lived in what is now Morocco more than 13,700 years ago.
The researchers tell the PNAS journal that the individuals were eating a lot of high-carbohydrate nutty foods.
The poor condition of their teeth suggests they were often in agony.
"At a certain point, the tooth nerve dies but up until that moment, the pain is very bad and if you get an abscess the pain is excruciating because of the pressure on the jaw," explained Dr Louise Humphrey, from London's Natural History Museum.
"Then, of course, the bone eventually perforates and the abscess drains away, and we see this in a lot of the jaw remains that we studied."
With all our sugary foods, tooth decay has become a ubiquitous problem for modern societies, but it was not always quite so bad.
Dental health took a definite turn for the worse when people settled into agricultural communities with domesticated crops and started to consume far more carbohydrates. But even in earlier hunter-gatherer societies, it seems, the sugar-rich content in some plant foods was causing difficulties.
Scientists reviewed the dental condition of 52 skeletons dug up at the Grotte des Pigeons complex at Taforalt in eastern Morocco over the past 10 years.
These skeletons covered a period from 13,700 years ago to about 15,000 years ago.
All bar three individuals displayed tooth decay, with cavities or other lesions affecting more than half of the surviving teeth. In some individuals, the oral health was so bad that destructive abscesses had developed.
Wild plant remains at Taforalt indicate these Stone Age people were snacking frequently on sweet acorns, pine nuts and pistachios. Snails were also popular.
With little if any oral hygiene, the Taforalt diet would have fuelled the mouth bacteria that produce the acid that rots tooth enamel.
As well as pain, the individuals on occasion probably had extremely bad breath.
What is interesting about this study is that it identifies high rates of tooth decay several thousand years before the wide-scale adoption of agricultural practices.
But although the Taforalt people were still gathering wild plants, they had nonetheless become a relatively sedentary community.
This is evidenced from the long sequence of burials at Grotte des Pigeons and its deep "rubbish tip" containing plant discards - factors that enabled the scientists to examine both a large number of individuals and tie their oral health to the types of foods they were consuming.
Sweet acorns were a particularly dominant feature in the diet, said Dr Humphrey, and may have been the prime cause of much of the dental decay.
"Sweet acorns are neat, easily storable packages of carbohydrate. We think they were cooking them, and that would have made them sticky. The cooking process would have already started to break down the carbohydrates, but the stickiness of the food would then have got into the gaps in the teeth and literally stuck around. And if you've already got cavities, it becomes a bit of a vicious circle."
It is clear the Taforalt individuals practised cultural modification of the teeth. In more than 90% of cases, one or both upper-central incisors (the top front teeth) had been removed. Whether rotten teeth were also removed is uncertain, however.
"You don't normally get bad decay on the upper-central incisors, so this must have been a ritual removal. Why they did it, we don't know; and so although they obviously knew how to remove teeth, we don't have the evidence to say they were also removing unhealthy teeth."
Some of the earliest evidence of dentistry comes from about 6,500 years ago when beeswax was used to fill cavities.
The research project presented in PNAS is co-directed by Abdeljalil Bouzouggar from the National Institute of Science of Archaeology and Heritage (INSAP) in Rabat, Morocco; and Nick Barton from Oxford University, UK.
Jonathan.Amos-INTERNET@bbc.co.uk and follow me on Twitter: @BBCAmos