|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||12||6||6||75.000%|
It is the year 2036 and Europe is crowded by senior citizens. In order to keep them healthy, the European ministry for majority groups (seniors are a majority!) suggests to have them deliver the small amount of paper mail that is still being sent — typically to seniors. This suggestion is going to be implemented all over Europe.
The ministry has devised a “senior postmen system” in the following way: Europe has been divided into mail districts. A mail district has a street network of streets and junctions. Every street in the network can be walked in both directions. In each district, arbitrarily many senior citizens are available to be hired as mailman. Every morning, each mailman receives a bag with mail to be delivered on a tour that covers a part of the street network. Every tour must be senior–compatible, i.e. it must satisfy the following conditions:
Together, the tours must cover the given network: each street in the network must be part of exactly one tour.
The ministry now needs a software that, for a given mail district’s street network, will compute a set of senior–compatible tours that covers the network.
The input describes the street network.
The first input line contains two integers N and M. N is the number of junctions, and M is the number of streets. Junctions are numbered from 1 to N.
Each of the following M lines contains two integers u and v (1 ≤ u, v ≤ N, u 6= v), meaning that there is a street connecting junctions u and v.
For any input holds:
Each line of the output should correspond to one senior–compatible tour, and should list the numbers of the junctions in that tour. Junction numbers must be output in the order the junctions are passed by the mailman, with the starting (and ending) junction being output first (and only once).
If more than one solution exists, your program may output any one of them.
10 15 1 3 5 1 2 3 9 2 3 4 6 3 4 5 7 4 4 8 5 7 8 5 6 7 7 8 8 10 10 9
2 3 4 5 8 10 9 7 8 4 1 5 7 6 3
The following picture illustrates the street network and the three senior–compatible tours that may be used to cover it.
Note that there are several solutions to this example, among them some with only two tours.