The most long-awaited event for the seminary is vacancies when the Bursaks (state-owned seminar seminarians) go home. In groups, they head from Kiev along the high road, earning a livelihood of spiritual singing along wealthy farms.
Three bursaks: the theologian Freebie, philosopher Homa Brut and rhetorician Tiberius Gorobets, - having lost their way from the road at night, go out to the farm. The old woman, the hostess, lets the Bursaks spend the night on the condition that they put everyone in different places. Homa Brutus is about to fall asleep in the empty sheep’s stable, when an old woman enters. Flashing her eyes, she catches Homa and jumps onto his shoulders. “Ege, this is a witch,” Bursak guesses, but he is already rushing above the ground, sweat is rolling from him in hail. He begins to remember all the prayers and feels that the witch is weakening. With the speed of lightning, Khoma manages to jump out from under the old woman, jumps onto her back, picks up a log and begins to cool the witch. Wild cries are heard, the old woman falls exhausted to the ground - and already before Homa lies a young beauty with the last moaning. In fear, the bursak starts to flee in full swing and returns to Kiev.
The rector calls to Homu and orders to go to the far farm to the richest centurion - to read the prayers for his daughter, who returned from the battered walk. The dying wish of the darling: the seminar seminar Homa Brut should read the waste on it for three nights. So that he would not run away along the road, a wagon and a man of six healthy Kozakovs were sent. When they bring Bursak, the centurion asks him where he met his daughter. But Homa himself does not know this. When they bring him to the coffin, he recognizes the witch in the panel.
At dinner, the bursak listens to Kozakov’s tales of the tricks of the witch’s panel. By night, they lock him in the church where the coffin stands. Homa steps back to the choir and begins to pray. The witch rises from the coffin, but stumbles upon a circle circled by Homa around herself. She returns to the coffin, flies through the church in it, but loud prayers and a circle protect Homa. The coffin falls, a greened corpse rises from it, but a distant cry of a rooster is heard. The witch falls into the coffin, and its lid slams.
In the afternoon, the bursak sleeps, drinks the vodka, wanders around the village, and in the evening it becomes more thoughtful. He is again taken to church. He draws a lifebuoy, reads loudly and raises his head. The corpse is already nearby, staring at it with dead, green eyes. The terrible words of witch spells are carried by the wind through the church, a myriad of evil spirits bursting in the door. The cry of the rooster again ceases the demonic action. Homu became gray-haired in the morning barely alive. He asks the centurion to let him go, but he threatens with a terrible punishment for disobedience. Homa is trying to escape, but they are catching him.
The silence of the third hellish night inside the church explodes with the crack of the iron cover of the coffin. The witch’s teeth are knocking, spells are screaming, the doors are torn off the hinges, and the myriad power of the monsters fills the room with the sound of wings and the scratching of claws. Homa is already singing prayers of last resort. “Bring Wii!” The witch screams. Squat clubfoot monster with an iron face, the leader of the evil spirits, with heavy steps enters the church. He orders to lift his eyelids. “Do not look!” - He hears the inner voice of Homa, but does not hold back and looks. "Here he is!" - Viy points to him with an iron finger. Impure force rushes at the philosopher, and the spirit flies out of him. For the second time the rooster cries, the first listened to perfume. They rush away, but do not have time. And so the church remains forever with the monsters stuck in the doors and windows, is overgrown with weeds, and now no one will find a way to it.
Learning about the fate of Khoma, Tiberius Gorobets and Freebies commemorate his soul in Kiev, concluding after the third circle: the philosopher disappeared because he was afraid.