def topologicalSortUtil(self, v, visited, stack):
    visited[v] = True
    for i in self.graph[v]:
        if (visited[i] == False):
            self.topologicalSortUtil(i, visited, stack)
    stack.insert(0, v)
def topologicalSortUtil(self, v, visited, stack):
    visited[v] = True
    for i in self.graph[v]:
        if (visited[i] == False):
            self.topologicalSortUtil(i, visited, stack)
    stack.insert(0, v)