[CodeChef] Prob Tree and Queries