#P6066. [USACO05JAN] Watchcow S
[USACO05JAN] Watchcow S
Description
Farmer John has farms (). These farms are connected by roads (). Multiple edges may exist.
Bessie starts patrolling from farm . Each road must be traversed exactly once in each direction, and finally she must return to farm .
Please output one path that satisfies the requirements above.
It is guaranteed that such a path exists. If there are multiple valid paths, output any one of them.
Input Format
The first line contains two integers .
The next lines each contain two integers , describing a road between and .
Output Format
Output the farms visited, one per line.
4 5
1 2
1 4
2 3
2 4
3 4
1
2
3
4
2
1
4
3
2
4
1
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号