A person dies and meets God, the Devil and Bob in his afterlife. He does not know which one is which. However, he knows that God always speaks the truth, the Devil always lies and Bob randomly speaks the truth sometimes and sometimes he lies.
He is allowed to ask each entity one or more yes-no questions. He is allowed to ask three such questions. He must deduce the identities of the three entities with the answers he gets in order to find a place in heaven. If he fails to do so, he is sent to hell.
How should he ask the three questions to get into heaven?