DAG problem

You are given a Directed Acyclic Graph, n <=2000, m <=n*(n-1)/2, no self loops, no multiple edges. node 1 is the parent. i.e. it has no incoming edges. Now, for every other node i, we should find the number of edges that lie on some path from 1 to i. You should print n-1 values.
Eg. n=3, 1->2,1->3,2->3, Answer is 1,3.

//