CSES : GRAPH

I was solving this question on graph on CSES getting RE for two test cases out of 18 , i having commented the line giving overflow , what’s wrong in the code i am not able to find out
solution