Today is May 10, 2332. All earth resources were depleted many years ago. The war which followed gave rise to the Space Suckers Alliance - the mightiest organization in the solar system controlling the trade with valuable raw materials.
Your today's assignment as a Sucker Cadet is to fly your standard Elephant-class mining ship through the asteroid belt in the sector gamma. Your ship is equipped with a battery of M sucking-beam generators (SBGs) for collecting M different kinds of raw materials. Your prospectors have explored N asteroids and reported the materials present on them. You are assigned to collect all available materials from these asteroids. However, your SBGs are not very advanced. You have only one beam source mutually used by all SBGs. Individual SBGs can be independently open or closed. In order to suck materials from a given asteroid, you need to turn on the source. Once the source is turned on, all SBGs that are open will start sucking. You may not suck a material that is not present or your ship will explode. Moreover, each SBG can be opened and closed only once during your mission. Therefore, after you open a particular SBG, you can only visit the asteroids that contain the corresponding material until you close this SBG. Since SBGs can be opened and closed only once, asteroids containing any given material must form a contiguous block in your flight plan.
3 5 11010 00110 10111Output file:
5 3 4 1 2