Pick larger subtrees first to prevent repeated work.