Your expedition ends in the heart of the ancient temple. While examining the inscriptions in the dark, two streams of green smoke suddenly appear. The walls are starting to shake. The gigantic hourglass begins to flow for an hour, and a roar tells you that when that happens, you don’t want to be here. Can you use math to escape the temple? Dennis E. Shasha shows you how.

**Transcript:**

You’ve found the hidden switches, evaded the secret traps, and now your expedition finally stands at the heart of the ancient temple inside The Lost City. But as you study the inscriptions in the near-total darkness, two of the eight graduate students accompanying you bump into the alter. Suddenly, two wisps of green smoke burst forth, and the walls begin to shake. Fleeing for your lives, you come to a room you passed before with five hallways, including the one to the altar and the one leading back outside.

The giant sandglass in the center is now flowing less than an hour before it empties, and the rumbling tells you that you don’t want to be around when that happens. From what you recall of your way here, it would take about 20 minutes to reach the exit at a fast pace. You know this is the last junction before the exit, but your trail markings have been erased, and no one remembers the way.

If nine of you split up, there should be just enough time for each group to explore one of the four halls ahead and report back to this room, with everyone then making a run down the correct path. There’s just one problem; the inscriptions told of the altar’s curse: the spirits of the city’s King and Queen possessing intruders and leading them to their doom through deception. Remembering the green smoke, you realize two of the students have been cursed.

At any time, one or both of them might lie, though they also might tell the truth. You know for sure that the curse didn’t get you, but you don’t know which students can’t be trusted, and because the possessed students may lie only occasionally, there is no guaranteed way to test them to determine which are cursed. Can you figure out a way to ensure that you all escape? Don’t worry about the possessed students attacking or otherwise harming the others. This curse only affects their communication.

The first thing to realize is that since you know you aren’t possessed, you can explore one of the halls alone. This leaves eight students for the remaining three paths. Sending groups of four down just two of the paths won’t work because if one group came back split two versus two, you’d have to guess who to trust. But splitting them into one pair and two trios would work every time, and here’s why.

The possessed students might lie, or they might not, but you know there are only two of them, while the other six will always tell the truth. When each group returns to the hall, all members will either give the same report or argue about whether they found the exit. If a trio returns in total agreement, then you know none of them are lying. You can’t be sure either way with the pair, but all you need is reliable evidence about three of the four paths. The fourth you can figure out using the process of elimination.

Of course, none of this matters if you’re lucky enough to find the exit yourself, but otherwise, putting everything together leaves you with three possibilities. If each group gives a consistent answer, either everyone tells the truth, or the two possessed students are paired together. In either case, ignore the duo. If there’s only one group arguing, both others must be telling the truth, and if there are two conflicts, then the possessed students are in separate groups, and you can safely trust the majority in both trios since at least two people in each will be truthful.

The temple collapses behind you as greenish vapors escape from two of the students. You’re all safe and free from the curse. After that ordeal, you tell your group they all deserve a vacation, and you happen to have another expedition coming up.