Magic Square

If you have good observations skills, you may found that building a Magic Square is simple. A Magic Square has only an odd number N of rows and columns. For this problem you could expect the values to be 3 ≤ N ≤ 15. A Magic Square is created by integer numbers in the range from 1 to N2, with a peculiar property, the “sum of the numbers” in each row, column and diagonal is the same value. For example the case for n = 3 is: M. Square 8 1 6 3 5 7 4 9 2 Rows 8+1+6 = 15 3+5+7 = 15 4+9+2 = 15 Columns 8+3+4 = 15 1+5+9 = 15 6+7+2 = 15 Diagonals 8+5+2 = 15 4+5+6 = 15 Hint: Imagine that the square is rounded. That is, the last row is connected with the first row and the last column is connected with the first column. As shown in the examples, the starting point is the center of the first row and observe how the numbers are placed following diagonals. There is only one more thing to observe, what happens when you find a cell that is already in use. Input A file with several lines, each line has the value of n. Output For each input line, print N and the sum in the first line, followed by the magic square. To see a nice looking square, take into account the maximum length in characters of N2 and print each number with the maximum length preceded by one space or blank character. Print one line between squares. Sample Input 3 5 Sample Output n=3, sum=15 816 357 492 n=5, sum=65 1724 1 815 23 5 71416 4 6132022 10121921 3 111825 2 9