Graph problem

problem link- FIRESC Problem - CodeChef
my code: code1.txt - Google Drive
Dunno why this gives “wrong soln”. Please help

There may be other reasons, too.

flagged !