Code Submission Evaluation System Login

Datatähti Open 2018

Start:N/A
End:N/A
 

Tasks | Scoreboard | Statistics


CSES - Datatähti Open 2018 - Area 50CSES - Area 50

Area 50

Time limit:N/A
Memory limit:N/A

On the border of Metsälä and Syrjälä there is a fenced area which is known as "Area 50". It can be presented as a $50 \times 50$ grid whose squares are numbered $1,2,\ldots,50^2$. Each square has a distinct number.

Kotivalo wants to get a better picture of the area and has sent $100$ parachute robots to investigate the area. Each robot first lands at a random square. Then it $100$ times sends the number of the square where it is located at the moment, and then randomly moves left, right, up or down (but never outside the area). After that, the robot destroys itself.

Could you help Kotivalo to create a map of the area based on the information given by the robots?

Input

The input contains $100$ lines, and each of them has $100$ integers: the numbers of the squares sent by a robot in the order it has visited them.

Output

Print $50$ lines, each of them with $50$ integers: the map of the area. Each number $1,2,\ldots,50^2$ must appear exactly once in the map.

Grading

In this task, there is only one input file which is available here. You have to submit an output file that corresponds to the input file.

You will get a point for each robot whose information matches your map, i.e., your final score will be between $0 \ldots 100$ points.