I was solving this question http://codeforces.net/problemset/problem/696/E and my code is passsing in less than a second int max test cases as in test case 10 but it is giving TLE in test case 14 where there is a single node.I am unable to find where it is getting TLE. someone please help and please do not down vote as i have been caught for a while. My submission: http://codeforces.net/contest/696/submission/19464350