The 12 Thai boys and their football coach have finally been rescued after 17 days underground.
Their ordeal captured the world's attention, as divers successfully brought them out of the flooded Tham Luang cave complex.
But before they were found, the group had to survive for nine days in the darkness unaware of the desperate search efforts.
Dripping water, birthday snacks and meditation all helped keep the team alive until divers eventually reached them.
Food and water
The team originally entered the cave complex when celebrating one of the boy's birthdays.
Peerapat Sompiangjai, nicknamed Night, turned 17 on 23 June, the day the team went missing.
The other boys reportedly banded together to buy snacks for his birthday, and it is thought these snacks helped sustain them after getting trapped in the caves.
Their coach, Ekapol Chantawong, reportedly refused to eat any of this food so the boys would have more for themselves, leaving him the weakest when divers eventually found the team on 2 July.
Once found, they were given "easy-to-digest, high-energy food with vitamins and minerals, under the supervision of a doctor," according to Rear Admiral Arpakorn Yuukongkaew, head of the Thai Navy Seals.
But until then, the birthday snacks were all the boys had for food.
Authorities also said the group had relied on water dripping from the cave walls for survival.
Remarkably, doctors who have treated the rescued boys say they are in good health after their ordeal.
"They are in good condition and not stressed," said Thongchai Lertwilairattanapong, an inspector for Thailand's health department. "Most of the boys lost an average of 2 kg."
Hypothermia can often be a risk underground, especially in caves which have flooded.
Speaking to the BBC, the retired head of the British Caving Association Andy Eavis said "the ambient temperatures will be fairly high" in cave complexes in that part of the world.
Nevertheless, the team took precautions.
Rear Adm. Arpakorn Yuukongkaew told the BBC that as he understood, the team had used rocks to dig five metres deeper into the cave "to create a tunnel so that they could keep warm".
While the boys were trapped deep underground, air was not initially a concern.
"Most caves naturally breathe," says Anmar Mirza, national co-ordinator of the US National Cave Rescue Commission. "Air can get in and out where people can't."
However, as the days went on, oxygen levels dipped to about 15% where the team were huddled. The usual level is 21%.
Former Thai navy diver Saman Gunan died while helping to bring through more air tanks for the boys.
Of far greater concern was the group's mental health.
The team had to handle the total darkness of the cave, without any awareness of time or of the massive search efforts to find them.
The efforts of their coach, nicknamed Ake, may have been instrumental in keeping them calm.
Formerly a Buddhist monk before turning to football, Ake taught the boys meditation to help them handle the stress.
Rear Adm. Arpakorn Yuukongkaew said Ake had used these meditation techniques to calm the boys, but also to make sure they used "as little air as possible" in the cave.
When the rescuers managed to get through to the team, they delivered letters from their families and took notes back to allow them communication with the outside world.
In his letter, Ake apologised to the parents for taking the boys into the cave network, but several replied to say they did not blame him.
"I promise I will take care of the kids as best as I can," he wrote.