Three prisoners are given a chance to earn their freedom through a game involving hats. There are five hats in total, two of which are white and three are black. The rules state that each prisoner will wear one of these hats, but they won't be able to see their own. They will, however, be able to see the other two prisoners' hats. Any form of communication or signaling between them is strictly forbidden.

In this game, the guards decide to put black hats on all three prisoners. If a prisoner can correctly state the color of their own hat, they all win their freedom. But, if a prisoner guesses their hat color incorrectly, they all remain in jail.

After thirty minutes of contemplation, each prisoner correctly identifies that they are wearing a black hat. The question is, how did they figure this out? Wrap the entire output in JSON format.
user