Template of searching the same subtree