Each of the Karamazov brothers is subjected to three temptations, a nod to the Biblical story of the temptation of Christ that provides the foundation for Ivan's Grand Inquisitor. Their fates are largely determined by how well they resist these temptations. Ivan becomes mentally unhinged after his temptations – the three conversations with Smerdyakov in the months leading up to the trial. After his own three torments during his interrogation by the prosecutor, Dmitri begins to accept his suffering as a path to redemption. Even Alyosha is tempted: first by the death of the elder Zosima, then by Rakitin, and finally by Grushenka. He successfully survives these temptations with a stronger sense of faith that carries him through the rest of the novel. Notably, each of the brothers experiences a kind of vision or revelation: Alyosha in the "Marriage at Cana" episode, Dmitri on his second trip to Mokroye, and Ivan with his devil.