DFS solution with marks
DFS solution with marks