Solution:
Imagine it this way:
Let's pretend we're person C. We see that A and B each have green hats. So there's two possibilities. Either our hat is green, or yellow. First, let's suppose that our hat WAS yellow. What would happen?
Well, if that were the case, person A would see a green and a yellow hat. He'd see a green hat on person B's head, and a yellow hat on person C's head. So in this case, person A could make a simple deduction. He would know that person B saw a green hat. And person B couldn't have seen the green hat on person C's head. Person B HAD to have seen the green hat on Person A's head. Therefore, person A would know that his own hat was green! So person A would stand up pretty quickly and say "I *know* I have a green hat!"
But that didn't happen! Person A *didn't* make this conclusion. So obviously, since it DIDN'T happen, our hat (that is, person C's hat) is NOT yellow, because if it were, Person A (or person B for that matter) would be able to make a conclusion right away, and they didn't. Therefore, the hat on person C's head is green!
(Now here's where Nef left off)
More specifically, if all the hats are green, *nobody* can logically prove the color of their own hat if all they know is that each other person saw a green hat. Hence, everyone will sit around and say nothing. But that's the ONLY case where nobody can determine anything. For any OTHER combination of hat colors, at least one person can logically deduce the color of their own hat. Three green hats is the only way an impasse can be reached. So because we know that to be true, we actually *can* determine the color of our own hat, because if nobody is able to conclude anything, then we can conclude something!
(See? lol)
Of course, this relies on the intelligence of the other two people as well. If they're both 4-year old kids, they might have known enough to acknowledge that they saw a green hat, but not be smart enough to deduce their own hat color simply by the other people's actions. But for the sake of the problem, we're assuming that the other people are reasonably smart.