you give positive integer n represent number nod Directed Acyclic Graph DAG the node number 0 n 1 inclusiveYou give 2d integer array edge edgesi fromi toi denote unidirectional edge fromi toi graphReturn list answer answeri list ancestor ith node sort ascend orderA node u ancestor node v u reach v set edge Example 1input n 8 edgelist 030413242735363746output 0102013012340123explanationthe diagram represent input graph Nodes 0 1 2 ancestor Node 3 ancestor 0 1 Node 4 ancestor 0 2 Node 5 ancestor 0 1 3 Node 6 ancestor 0 1 2 3 4 Node 7 ancestor 0 1 2 3example 2input n 5 edgelist 01020304121314232434output 0010120123explanationthe diagram represent input graph Node 0 ancestor Node 1 ancestor 0 Node 2 ancestor 0 1 Node 3 ancestor 0 1 2 Node 4 ancestor 0 1 2 3 constraints1 n 10000 edgeslength min2000 n n 1 2edgesilength 20 fromi toi n 1fromi toithere duplicate edgesthe graph direct acyclic