|
|||||||
|
Messenger
King Informaticus, a ruler of Byteland has a lot to worry about. Secret service informed
him that a cruel King Hacker is about to attack his kingdom. Moreover, secret agents
of Hacker have been already sent to one of the cities in
Byteland in order to hinder preparations for defense. Informaticus decided to warn his subjects against an oncoming danger. TaskWrite a program that:
InputIn the first line of the text file GON.IN one integer n is written. This is the number of all the cities in Byteland. In the second line one integer d is written. This is the number of all the direct road connections. In each of the following d lines there is written the description of one direct road connection, it consists of two different integers from the interval [1..n] separated by a single space. Each connection appears only once in the text file.
OutputIn the first line of the text file GON.OUT there should be written the plan of the route of the first messenger as a series of n different integers from the interval [1..n], separated by a single space. In the second line there should be written, in the same way, the plan of the route of the second agent.
ExampleThe file GON.IN is the description of the road system shown on the picture: 5 6 1 2 2 3 3 4 4 1 4 5 5 2
In this case the correct solution is the file GON.OUT: The first messenger could move on the route : 1 2 3 2 5 4, and the second one on the route : 1 4 5 4 3 2.
Your program should look for the file GON.IN in the current directory and produce the output file GON.OUT in the current directory too. The file containing the source code of your program should have a name GON.???, whereas you should put three-letter abbreviation of the used programming language name instead of ???. The same program in executable form should be written in file GON.EXE |