Minimal Labels

题意翻译

有一个 $n$ 个点, $m$ 条边的有向无环图。你需要输出一个 $1$ 到 $n$ 的全排列 $label$,使得: - 如果从点 $v$ 到点 $u$ 有一条有向边,那么必须满足 $label_v<label_u$ 。 - 在所有满足要求的全排列中,需要满足答案的字典序最小 输出这个全排列。 [Meatherm](https://www.luogu.com.cn/user/108949) && [Flamire](https://www.luogu.com.cn/user/87393) tql!

题目描述

You are given a directed acyclic graph with $ n $ vertices and $ m $ edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected. You should assign labels to all vertices in such a way that: - Labels form a valid permutation of length $ n $ — an integer sequence such that each integer from $ 1 $ to $ n $ appears exactly once in it. - If there exists an edge from vertex $ v $ to vertex $ u $ then $ label_{v} $ should be smaller than $ label_{u} $ . - Permutation should be lexicographically smallest among all suitable. Find such sequence of labels to satisfy all the conditions.

输入输出格式

输入格式


The first line contains two integer numbers $ n $ , $ m $ ( $ 2<=n<=10^{5},1<=m<=10^{5} $ ). Next $ m $ lines contain two integer numbers $ v $ and $ u $ ( $ 1<=v,u<=n,v≠u $ ) — edges of the graph. Edges are directed, graph doesn't contain loops or multiple edges.

输出格式


Print $ n $ numbers — lexicographically smallest correct permutation of labels of vertices.

输入输出样例

输入样例 #1

3 3
1 2
1 3
3 2

输出样例 #1

1 3 2 

输入样例 #2

4 5
3 1
4 1
2 3
3 4
2 4

输出样例 #2

4 1 2 3 

输入样例 #3

5 4
3 1
2 1
2 3
4 5

输出样例 #3

3 1 2 4 5