Ion is an
young artists, preparing to hold his first show. At the show he will sing
n songs, numbered from
1 to n.
Now he wants to set the order of the songs (the playlist).
He knows that some songs would certainly not have the same effect on the audience
if they we're played one after the other (they don't go well together) and he
therefore has to watch out for this aspect when he decides the order in which
the songs will be played.
For instance, if n=3,
and the songs 1 and 2
don't go well togther, the only acceptable playlists are 1,
3, 2
or 2, 3,
1.
Task
Determine an acceptable playlist.
Input data
Input file playlist.in contains on the first line the positive integer n, representing the number of songs. The second line contains a positive integer m, representing the number of pairs of songs that don't match if sung one after the other. Each of the following m lines contains two integers between 1 and n, separated by one space character, representing the pairs of songs that don't go well if played one after the other.
Output data
Output file playlist.out will contain a single line with n integers separated by a single space character, representing the songs int the order from the playlist.
Constraints
playlist.in | playlist.out |
5 4 2 3 1 5 1 4 2 4 |
1 2 5 3 4 |
Time limit: 0.4 seconds
prof. Emanuela
Cerchez
Liceul de Informatica
"Grigore Moisil" Iasi
Contact:emanuela.cerchez@gmail.com