A prison warden plays the following game with 4 male prisoners, who are all eager to escape.

Three of them are standing on steps looking straight ahead, such that the 1$^\text{st}$ one at the top can see both the 2$^\text{nd}$ and 3$^\text{rd},$ and the 2$^\text{nd}$ in the middle can see only the 3$^\text{rd}$ at the bottom who can see nobody. The 4$^\text{th}$ prisoner is in a room, totally separated from the other three. But they can all hear the voices of others.

The prisoners know that there are 2 black and 2 white hats available for them each to wear, but they do not know their own hat color. The 1$^\text{st}$ is wearing a black hat, the 2$^\text{nd}$ is wearing a white hat, the 3$^\text{rd}$ is wearing a black hat, and the 4$^\text{th}$ is wearing a white hat.

The prison warden promised that the first to shout his color correctly will be released, otherwise he will be shot. Who will be the first to shout his hat color?