There were once three fugitives that was caught in the act of crime. When they arrived to prison all the cells were already full. So the warden though of an idea, "I'll line you three rascals up. The tallest at the back of the line and the shortest at the front. The last one'll be at middle." He then brought out a box which everyone could see that there were five hats inside, three white ones and two red ones. The warden fit one hat for each of the prisoners without any of them seeing what color it was. "The game is simple. All you have to do is guess the color of your hat. You can say either, "I don't know." or the color of your hat. If you get it wrong you all die and if you say anything else besides those things, or all of you can't answer at all, all of you still die. If you get it right, you get out of here." They were all facing the same direction and lined up in such a way such that the one at the back can see the color of the hat of the people in front of him and the one in the middle, the same while the one in front directly sees a brick wall.
Warden:"You! What color is your hat?" Prisoner 1:"I don't know." Warden:"You in the middle. What about you?" Prisoner 2:"I don't know." Warden:"I bet you can't guess yours, seeing nothing and all. So what's you color?"
The prisoner in front says his color correctly and they all walk free. What was his color?