start working on a tree algorithm which help us to search a good path