One test case not passing

i tried like for every node checking whether there is a cycle or not if yes adding all the components of cycle else adding just one

please help am waiting

hey @chemant077 sorry for the delay.dry run your code for
78 30
47 8
18 46
62 44
49 3
15 38
22 9
24 7
9 51
56 9
10 17
30 8
39 7
78 26
2 13
9 16
49 37
61 39
74 31
76 74
72 69
66 32
62 37
71 39
66 71
4 10
12 15
65 61
40 6
44 9
31 34

you are getting 37
answer shd be 1.

Where are u facing issue??