Help in Solving this tree question

Can someone tell right approach to this question?
Link to problem
@rgb_icpc10
@callmepandey
@abhisheksaini1
@apoorv_me