Query on a tree II

Problem Name:
Query on a tree II
Site:Spoj
Links:
Tags:
Problem setters: