How did he know the color of his hat?
Four people were placed in a row and the fourth person was placed behind a wall.
On top of each of them is a hat either black or white as shown in the drawing, where there are 2 white and 2 black hats. Each person can see the hat worn by the person in front of him and cannot see the color of his hat, the fourth person behind the wall can't see the hats in front of him and he can't see his own hat (people can't communicate with each other).
The question was asked to these people: What color is the hat on your head? After a period of time, a person answered and his answer was correct. Who is this person and how did he know the color of his hat?