text: #dictionary of lists
  graph = {
      'A' : ['B','C'],
      'B' : ['D', 'E'],
      'C' : ['F'],
      'D' : [],
      'E' : ['F'],
      'F' : []
  }
  
  visited = set() # Set to keep track of visited nodes.
  
  def dfs(visited, graph, node):
      if node not in visited:
          print (node)
          visited.add(node)
          for neighbour in graph[node]:
              dfs(visited, graph, neighbour)
  
  # Driver Code
  dfs(visited, graph, 'A')
  