It has not been easy extracting the 12 boys and their soccer coach from the flooded underground cave complex in northern Thailand.

Each person had to be tethered to two divers and follow a 3-mile-long rope guiding them back to the cave's entrance, part of it while being submerged with a full face mask.

All 12 boys and their soccer coach have been rescued from a Thai cave complex after a two-week ordeal that gripped the world.

Because the team was trapped in an underground tunnel, 2 1/2 miles from the mouth of the cave, getting them out was difficult. The boys had to travel that entire distance tethered to two cave divers with oxygen tanks.

This graphic shows how the team was taken out of the cave:

About 0.6 miles of the journey was completely underwater, where everyone had to wear full face masks.

And because the cave's tunnels are dark, the divers also had to hold onto a 3-mile-long rope and be guided by lights back to the main entrance.

The team members were also given antianxiety medication to calm them while the divers got them out.

The last four boys and their 25-year-old soccer coach were extracted from the Tham Luang cave network on Tuesday evening and taken to a nearby hospital, where the eight other boys who were pulled out on Sunday and Monday are recovering. They have been kept in a sterilized isolation unit, are required to eat soft and plain food, and are not allowed to watch TV.