ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1656. Far Away Kingdom's Army

Time limit: 1.0 second
Memory limit: 64 MB
Solovey-Razboynik invaded Far Away Kingdom, and nobody could be safe from him. Then King called his Army Commander and ordered him to send his brave soldiers against the foe, and not come back without the victory. Commander went to Baba Yaga to ask for her advice.
“To conquer the enemy, you need a special formation,” she said. ”Put your soldiers into squares, but remember that if two soldiers stand in the same row or column on the same side from the center of that row or column, then the soldier who is closer to the center must be at least as tall as the other. Only then will you be able to defeat Solovey. If you don't do as I say, he'll blow your army away.”
Commander assigned the soldiers to several squares and measured their height. However, to place them as Baba Yaga had said wasn't easy. Help him to place the soldiers as required.

Input

In the first line you are given the size n of the square; it is an odd number from 3 to 9. Each of the next n2 lines contains the height of a soldier in centimeters. The army of Far Away Kingdom enrolls men whose height is from 170 to 200 centimeters.

Output

Output an n × n table with cells showing the heights of soldiers from the given list. In each row and in each column, the largest number must be in the center, and the numbers mustn't increase in the directions from the center to the ends.

Sample

inputoutput
3
170
170
180
175
170
175
175
170
175
170 175 170
175 180 175
170 175 170
Problem Author: Vladimir Yakovlev (idea by Magaz Asanov)
Problem Source: NEERC 2008, Eastern subregion quarterfinals