Finished the recover tree problem.