query on a tree