Problem: Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.

Input

The only line contains odd integer n (1 ≤ n ≤ 49).

Output

Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.

Examples

Input

1


Output

1


Input

3


Output

2 1 4
3 5 7
6 9 8

Solution (in PYTHON3):

Solution:
from collections import namedtuple

Dir = namedtuple('Dir', ['x', 'y'])


dirs4 = [
    Dir(-1, -1),
    Dir(-1,  1),
    Dir( 1, -1),
    Dir( 1,  1),
]

dirs = [
    (dirs4[0], Dir( 1,  0)),
    (dirs4[0], Dir( 0,  1)),

    (dirs4[1], Dir( 1,  0)),
    (dirs4[1], Dir( 0, -1)),

    (dirs4[2], Dir(-1,  0)),
    (dirs4[2], Dir( 0,  1)),

    (dirs4[3], Dir(-1,  0)),
    (dirs4[3], Dir( 0, -1)),
]



def build_pattern(n):
    odd_n = n * n // 2 + 1

    m = [[0] * n for _ in range (n)]

    mid = n // 2
    for i in range(n):
        m[i][mid] = 1
    odd_n -= n
    for i in range(n):
        m[mid][i] = 1
    odd_n -= n - 1

    step = 2
    while odd_n > 0:
        for dir in dirs4:
            m[mid + step * dir.x][mid + step * dir.y] = 1
        odd_n -= 4

        o_odd_n = odd_n // 8
        for start, dir in dirs:
            for i in range(1, o_odd_n + 1):
                x = mid + step * start.x + i * dir.x
                y = mid + step * start.y + i * dir.y
                if x == mid or y == mid:
                    break
                m[x][y] = 1
                odd_n -= 1

        step += 2

    return m

def solve(n):
    odds = [x for x in range(1, n * n + 1) if x % 2 != 0]
    evens = [x for x in range(1, n * n) if x % 2 == 0]

    odds_i, evens_i = 0, 0

    mp = build_pattern(n)
    m = [[0] * n for _ in range (n)]

    for i in range(n):
        for j in range(n):
            if mp[i][j] > 0:
                m[i][j] = odds[odds_i]
                odds_i += 1

            else:
                m[i][j] = evens[evens_i]
                evens_i += 1

    return m


def main():
    n = int(input())
    m = solve(n)
    for row in m:
        print(' '.join(map(str, row)))

main()