The last remaining member of the Wild Boars soccer team and their assistant coach have been pulled out of a flooded cave in Thailand, bringing an end to a near three-week ordeal that prompted an international rescue effort and captivated audiences around the world. The 12th boy and his coach were the last of the team to be rescued Tuesday, after a complicated three-day operation to extricate the team, who became trapped on June 23 when rising flood water cut them off deep inside the cave. In the last 18 days, what began as a local search for the missing 13 turned into a complex rescue operation, involving hundreds of experts who flew in from around the world to help. The parents of the boys have maintained a constant vigil outside the cave since they went missing, praying for their safe return. FOLLOW LIVE UPDATES All of the boys and their coach have now been transported to a nearby hospital where eight of their teammates are recuperating after being rescued Sunday and Monday. The last of the group to emerge from the cave on Tuesday were four Navy SEALs, including a doctor who stayed with the team for a week after their discovery. “We are not sure if this is a miracle, a science, or what. All the thirteen Wild Boars are now out of the cave,” the Thai Navy SEALS said in a Facebook post confirming the entire soccer team had been rescued. Nineteen divers entered the cave at 10 a.m. local time Tuesday (11 p.m. Monday ET), many on their third mission in three days, with the aim of bringing everyone inside the cave out. Tuesday’s rescue took nine hours in total, from the time the divers entered the cave to bringing out the boys and their coach. ‘I can sleep well now’ Nopparat Kanthawong, the team’s head coach, told CNN the wait for the boys and their assistant coach to be rescued has been agonizingly slow. “I’m happy a lot more than other days because we were waiting for this day for a long time,” he said in an interview late Tuesday at his house in northern Thailand’s Mae Sai District. He added: “I can sleep well now and have good dreams at least for this one night.” Kanthawong said he didn’t know the players and coach were going into the cave. “At this time, now that the coach is out, just wait until he gives any statements and let’s just wait altogether and find out (why they went into the cave) at the same time,” he said. Kanthawong said he is eager to comfort his players now that they are safe. “I’m going to give them a hug,” he said. Rescued boys recovering in hospital Earlier Tuesday, more details emerged about the ages and condition of the children already freed from the cave. All eight boys rescued on Sunday and Monday are being treated in an isolation ward in a Chiang Rai hospital. Medical officials told reporters Tuesday that they’re healthy, fever-free, mentally fit and “seem to be in high spirits.” Some of the boys have even asked for bread with chocolate spread – which they were given, said Jedsada Chokedamrongsook, the permanent secretary of the Thai Health Ministry. But they’ll mostly be eating a food similar to milk and rich in proteins and nutrients. Chokedamrongsook said the first group of boys taken out on Sunday were aged 14 to 16. Their body temperatures were very low when they emerged, and two are suspected of having lung inflammation. Families of the first four have been able to see their children through a glass window, Chokedamrongsook said. They were also able to talk on the phone. They’ll be allowed to enter the room if tests show the boys are free of infection. The second group freed on Monday were aged 12 to 14. One had a very slow heartbeat but had responded well to treatment, Chokedamrongsook said. The hospital has sent test samples from the boys to a lab in Bangkok. Authorities will likely look for signs of Histoplasmosis, also known as “cave disease,” an infection caused by breathing in spores of a fungus often found in bird and bat droppings. They are all likely to stay in hospital for up to a week, due to their weakened immune systems. Thai Prime Minister Gen. Prayut Chan-ocha visited the hospital Monday, and spoke to relatives and hospital workers. Shortly after the news of the boys’ safe return broke, US President Donald Trump tweeted his congratulations to the Navy SEAL team. “On behalf of the United States, congratulations to the Thai Navy SEALs and all on the successful rescue of the 12 boys and their coach from the treacherous cave in Thailand. Such a beautiful moment – all freed, great job!” Treacherous conditions Divers involved in the rescue described treacherous conditions, with fast-moving shallow water passing through very narrow passages. “This is the hardest mission we’ve ever done. The lower the water is getting, the stronger the current. It’s stronger now. Every step of the extraction is risky,” said Narongsuk Keasub, a diver for the Electricity Generating Authority of Thailand. He’s one of a group of divers whose job is to transport air tanks into the tunnels for the SEAL teams. Before the final rescue, he told CNN that divers inside the cave faced a number of challenges. “We can only see our hands (at a) short distance. Secondly, the stones are razor sharp which is dangerous for our diving, (and) thirdly the passage is very narrow,” he said. Keasub said that the thought of their own children kept them going. “I’m quite emotional as a father – everybody has this feeling because we feel like it’s our children who are inside the cave.” A dangerous journey For several days, rain threatened to hamper what was already a complicated rescue mission. When it became clear the boys were likely going to have to dive out, experts were sent in to teach them how to use scuba gear. Officials sourced full-faced oxygen masks small enough to fit the boys, to remove the chances of them falling off during the long arduous journey through the craggy tunnels. Two days before the first four boys were rescued, officials warned that oxygen levels with in the cave had fallen to 15%. Forecasts of more rain also threatened to raise water levels, further educing the amount of available air and jeopardizing efforts to get the boys out. However, a few days of relatively clear skies allowed rescuers to pump enough water out of the cave to allow the boys to walk through some sections. During the hours-long trip out of the cave, each boy was accompanied underwater by two divers helping them navigate the dark, murky water. The most dangerous part is the first kilometer, during which the divers and boys are required to squeeze through a narrow, flooded channel. Rescuers needed to hold the boys’ oxygen tanks in front of them and swim pencil-like through submerged holes. Having completed this section, the boys are then handed over to separate, specialist rescue teams, who help assist them through the remainder of the cave, much of which they can wade through. So treacherous were the conditions that one Thai Navy SEAL died during operations last week, a blow to rescuers who faced a race against time to free the soccer team.