Four men have been buried all the way to the neck, only their heads stick out. They cannot turn their heads, so they can see only in front of them. A wall has been placed between A and B, so that A cannot see the other 3 (B, C, D), and viceversa.
All of them know in which position the others have been buried. So, for example, B knows that C and D can see him, even though he can’t see them.
A hat has been placed on top of each man’s head. All of them know that there are two black hats and two white hats, but no one is told the colour of the hat he’s wearing.
They will all be saved if at least one of them can safely say what colour is the hat he’s wearing. Otherwise they’ll all be decapitated.
Which one of them saved the day? And, most importantly, how?