There are three prisoners in a prison. A warden has 2 red and 3 green hats and he has decided to play the following game: He puts the prisoners in a row one behind the other and on the had of each prisoner he puts a hat. The first prisoner in the row can't see any of the hats, the second prisoner can see only the hat at the had of the first one, and the third prisoner can see the hats of the first two prisoners. If some of the prisoners tells the color of his own hat, he is free; but if he is wrong, the warden will kill him. If a prisoner remain silent for sufficiently long, he is returned to his cell. Of course, each of them would like to be rescued from the prison, but if he isn't sure about the color of his hat, he won't guess.

After noticing that second and third prisoner are silent for a long time, first prisoner (the one who doesn't see any hat) has concluded the color of his hat and told that to the warden. What is the color of the hat of the first prisoner? Explain your answer! (All prisoners know that there are 2 red and 3 green hats in total and all of them are good at mathematics.)
If the first two prisoners had red hats, the third one won't be silent (he would conclude that his hat is green). Hence, at least one of the first two prisoners has a green hat, and everybody knows that (because the third prisoner is silent). Thus if the first prisoner had red hat, the second one would conclude that he must be the one with the green hat. However, the second prisoner was silent and the hat at the hat of the first prisoner must be green.