Function to perform topological sort
static ArrayList < Integer > topo ( ArrayList < ArrayList < Integer > > adj , int V , ArrayList < Integer > indeg ) { Queue < Integer > q = new LinkedList < > ( ) ;