"Does everyone want coffee?" propositional logic problem 
When three professors are seated in a restaurant, the hostess asks them: “Does everyone want coffee?” The first professor says: “I do not know.” The second professor then says: “I do not know.” Finally, the third professor says: “No, not everyone wants coffee.” The hostess comes back and gives coffee to the professors who want it. How did she figure out who wanted coffee?

The solution is that the first two professors who say they don't know if everyone wants coffee are the ones who want coffee.
However, I don't understand the logic. For example, the first professor may not want coffee, but does not know if the other professors want coffee, and thus can answer "I do not know." So how can the hostess take an answer of "yes" from that?

If he knew that he does not want coffee, then he could tell the waitress 'no', because he then knows that NOT everyone wants coffee. The only possibility that he doesn't know it when he is asked is that he does want coffee  but does not know if the other two want some too.
The same logic applies for the second professor. Only the third then has perfect knowledge and can say 'yes' if he also wants coffee, and 'no' if not.
