Recursive,keep the track of the path