Recursive solve