## 45. The Cunning Spy

- The next spy who infiltrated the country, said the King, turned out to be much smarter than his predecessors. He was also arrested along with two native residents, one of whom was a knight, and the other a liar. All three appeared in court. The court knew that one of the accused was a knight, another a liar, and the third a spy (who sometimes lies and sometimes tells the truth), but it did not know who was who.

Let's denote the accused as $A, B$, and $C$.

First, $A$ stated:

- I am not a spy.

Then $B$ said:

- I am a spy.

The accused $C$ was then asked:

- Is $B$ really a spy?

In reality, the spy was $C$. Being a spy, he could choose to lie or tell the truth as he saw fit. In court, he was cunning and evasive, answering in a way that made it impossible to expose him as a spy.

What did $C$ answer to the judge's question?

![](https://cdn.mathpix.com/cropped/2024_05_21_5afa4e43618f5800e92dg-064.jpg?height=728&width=734&top_left_y=972&top_left_x=638)
45. The Crafty Spy. If A had answered the judge's question with "yes," he would have incriminated himself as the spy, because the judge (along with the jury) could reason as follows:

"Suppose B is the spy. Then all three accused would have given truthful testimonies, which is impossible since one of them is a liar. Therefore, B cannot be the spy. This means his testimony is false, so B is a liar. C's testimony is also false, and since C is not a liar (as B is the liar), C must be the spy."

Thus, if C had answered the judge's question with "yes," he would have been exposed as the spy. Knowing this, C wisely answered "no," thereby depriving the court of the ability to determine whether he was a spy or a native. (The court was only able to establish that either C is a knight and B is the spy, or C is a liar and A is the spy, or C is the spy.)