solution to find all paths