Query on a tree V

SPOJ - QTREE5