Kingdom Unity - Nzec Error - Java

My solution
Above is a link to my solution for Kingdom Unity , which requires us to find the number of articulation points for a graph and print number of such points * K for each test case. I have been trying to solve this problem for the past 3 hours but always end up getting NZEC Error. I cant find any test case where the code fails . I dont think it uses too much memory either, so what can be the problem ? Any help will be appreciated!