Help Needed in CHEFRRUN

Can someone help me with this problem? (Problem link below)
https://www.codechef.com/problems/CHEFRRUN

I tried to do it by applying Kosaraju’s Algorithm, but its showing WA in many TC’s
My Code link:-
https://www.codechef.com/viewsolution/49436993