题目描述
Problem Description
Find the lexicographically smallest Eulerian path in a directed graph.
Input Format
The first line contains two integers \( n \) and \( m \), representing the number of vertices and edges in the directed graph, respectively.
The next \( m \) lines each contain two integers \( u \) and \( v \), indicating that there is a directed edge from \( u \) to \( v \).
Output Format
If no Eulerian path exists, output a single line containing No.
Otherwise, output a single line with \( m+1 \) numbers, representing the lexicographically smallest Eulerian path.
Sample Input and Output
Sample Input #1
4 6
1 3
2 1
4 2
3 3
1 2
3 4
Sample Output #1
1 2 1 3 3 4 2
Sample Input #2
5 5
1 2
3 5
4 3
3 4
2 3
Sample Output #2
1 2 3 4 3 5
Sample Input #3
4 3
1 2
1 3
1 4
Sample Output #3
No
Notes
For 50% of the test cases, \( n, m \leq 10^3 \).
For 100% of the test cases, \( 1 \leq u, v \leq n \leq 10^5 \), \( m \leq 2 \times 10^5 \).
The graph is guaranteed to be connected when the directed edges are considered as undirected edges.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分