#K59167. Magic Square Generator

    ID: 30805 Type: Default 1000ms 256MiB

Magic Square Generator

Magic Square Generator

Given an odd integer \( n \) (with \(1 \leq n \leq 9\)), generate an \( n \times n \) magic square. A magic square is a square matrix in which the sum of every row, every column, and the two main diagonals is equal. In fact, the magic constant is given by \( M = \frac{n(n^2+1)}{2} \).

Your program should read the integer from standard input and print the magic square to standard output. Each number in the output must be right-aligned, using the width determined by the largest number \( n^2 \). If the input is not an odd integer between 1 and 9 (inclusive), the program should raise an error.

inputFormat

The input consists of a single integer \( n \) read from standard input.

outputFormat

Output the generated magic square to standard output. Each row should be printed on a new line, with each number right-aligned according to the width of \( n^2 \).

## sample
1
1