A tour firm wants to develop new bus tours. A tour can consist only of the cities, each pair of which has a route that connects them somehow (directly or through other cities).
The analysts have created a map of the nearby cities, with roads that connect them. Help them develop the tours.
Note: use space as a separator between the names of the cities in a tour. Each tour should be located on a new line.
For example, if there are tours {Rome, Milan, Athens}, {Berlin, Dresden}, {Helsinki, Stockholm}, the answer might be the following:
Rome Milan Athens
Berlin Dresden
Helsinki Stockholm