For this Question: For a directed acyclic graph (DAG), a topological ordering is a linear ordering of its vertices such that for every directed edge from vertex u to vertex v, u is listed before v.

Given a DAG find the Lexicographically smallest topological ordering.The first line consists of two space-separated integers denoting N and M.
Each of the following M lines consists of two space-separated integers X and Y denoting there is an edge from X directed toward Y.


<b>Constraints</b>
1<=N, M<=200000
1<=X, Y<=NPrint N space separated integers denoting the topological sort.Sample Input
5 6
1 2
1 3
2 3
2 4
3 4
3 5

Sample Output
1 2 3 4 5 , I have written this Solution Code: import heapq as hq
 
 
 
def addEdge(x, y):
    adj[x].append(y)
 
 
def topologicalSort():
    V = len(adj)
    in_degree = [0] * V
 
    for u in range(V):
        for x in adj[u]:
            in_degree[x] += 1
    s = []
    for i in range(V):
        if in_degree[i] == 0:
            hq.heappush(s, i)
 
    cnt = 0
 
    top_order = []
 
    while s:
 
        u = hq.heappop(s)
        top_order.append(u)
 
        for x in adj[u]:
            in_degree[x] -= 1
            if in_degree[x] == 0:
                hq.heappush(s, x)
 
        cnt += 1
 
    if cnt != V:
        print(-1)
        return
 
    for i in range(len(top_order)):
        if i!=0:
         print(top_order[i], end=" ")
 
 
if __name__ == "__main__":
    l = input();
    n = int(l.split(" ")[0])
    m = int(l.split(" ")[1])
    adj = [[] for _ in range(n+1)]
 
    for i in range(m):
        line = input()
        u = int(line.split(" ")[0])
        v = int(line.split(" ")[1])
        addEdge(u,v)
 
    topologicalSort(), In this Programming Language: Python, Now tell me if this Code is compilable or not?