tree recursive problem