Problem L
Road Plowing
In your town, there are several houses connected by roads. After a heavy snow, your company is contracted to clear all the roads. Unfortunately, there is a lot of snow, and a road can only be fully cleared by going over it with a snowplow twice. This can be done by going over the road in the same direction twice or going over it once in each direction. Can you find a single, continuous route that starts at any house and goes over every road in the town exactly twice?
Input
On the first line, you will be given two integers, $n$ and $c$ ($2 \le n \le 5 \cdot 10^4$, $1 \le c \le 10^5$), where $n$ is the number of houses (numbered $1$ to $n$) and $c$ is the number of roads. On the next $c$ lines, each line will contain two integers $a$ and $b$ ($1 \le a, b \le n$, $a \neq b$), representing a bidirectional road between house $a$ and house $b$. Each pair of houses is connected by at most one road. Each house connects to at least one road.
Output
Output a single line containing a list of $2c+1$ numbers separated by spaces, representing the sequence of houses your snowplow will visit. If multiple valid paths exist, you may return any one of them. The input is generated in such a way that at least one solution is guaranteed to exist.
| Sample Input 1 | Sample Output 1 |
|---|---|
2 1 1 2 |
1 2 1 |
| Sample Input 2 | Sample Output 2 |
|---|---|
4 4 1 2 2 3 1 3 3 4 |
3 2 1 2 3 1 3 4 3 |
