WA in DIGROT

i am getting wa in this problem
. i have tried many test cases but surely i seem to be missing something here…
please tell me some of the corner cases that must be going wrong here…
my solution to this problem