Given N, you must build an N×N matrix consisting of integer values from 1 to N.
Each value should appear exactly N times in the matrix.
The score of an array is defined as the greatest frequency of one element in the array. The score of a matrix is defined as the minimum score over all rows and columns.
Build a matrix with the greatest possible score.
Input:
The first line contains an integer, representing N.
Output:
Print N lines each containing N integers.
Notes and constaints:
1≤N≤11
Let O be the optimal score for a test and S be your score for a certain test case.
Then the test will be graded with max(0,100−25∗⌈O−S⌈O4⌉⌉) points.
The maximum frequency in [1,1] is 2. The maximum frequency in [2,2] is 2. The maximum frequency in [1,2] is 1.
Therefore, the score of this matrix is 1 and this is the best that we can, for N=2.