Problem F: 【图论基础】图的遍历

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:17 Solved:9

Description

给出n个点,m边的有向图,对于每个点v,求A(v)表示从点v出发,能到达的编号最大的点。n<100000

Sample Input Copy

4 3
1 2
2 4
4 3

Sample Output Copy

4 4 3 4